[openstreetmap/openstreetmap-website] Add some javascript to check dynamically if the username is already taken (PR #4402)

Anton Khorev notifications at github.com
Wed Dec 13 14:32:51 UTC 2023


@AntonKhorev commented on this pull request.



> @@ -223,4 +223,62 @@ $(document).ready(function () {
   $("#read_tou").on("click", function () {
     $("#continue").prop("disabled", !($(this).prop("checked") && $("#read_ct").prop("checked")));
   });
+
+
+  const isTaken /* Record<string, string> */ = {}
+
+  function indicateInvalidDisplayName(isValid /* boolean | undefined*/) {
+    // isValid might also be 'undefined', hence we check explicitly for 'true' and 'false'
+    $("#user_display_name").toggleClass("is-valid", isValid === true)
+    $("#user_display_name").toggleClass("is-invalid", isValid === false)
+  }
+
+  function checkDisplayName(){
+    const displayName = $("#user_display_name").val()
+    if(displayName === ""){

Right now if I start typing the name, this code will say that the name is valid after the first typed character. But it's obviously invalid.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4402#discussion_r1425442817
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/4402/review/1779779733 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20231213/bd680190/attachment.htm>


More information about the rails-dev mailing list