Comparing user sign up info in an array with user login inputConverting user input string to regular expressionPop up php table value to normal window combobox not working using javascriptHow to eval or parse jquery code that's pulled in as a .val() value?jquery window.click not working first timeHow to compare arrays in JavaScript?Handling client independent user logging inputHow to export JavaScript array info to csv (on client side)?keyup event not triggered for escape keyForm inputs have no cursor - jQuery UI in Chrome after htaccess loginHide/show an element based on value of var

How to speed up large double sums in a table?

How can I obtain and work with a Platonic dodecahedron?

How long does it take a postcard to get from USA to Germany?

Debian 9 server no sshd in auth.log

Installing Debian 10, upgrade to stable later?

Ab major 9th chord in Bach

Game artist computer workstation set-up – is this overkill?

How to deal with employer who keeps me at work after working hours

What are these silver "sporks" for?

TIP120 Transistor + Solenoid Failing Randomly

Do quaternary sulfur dications exist?

Huffman Code in C++

Given four points how can I find an equation for any pattern?

Explaining intravenous drug abuse to a small child

Problem with estimating a sequence with intuition

My large rocket is still flipping over

Endgame puzzle: How to avoid stalemate and win?

How to say something covers all the view up to the horizon line?

What is monoid homomorphism exactly?

Does Thanos's ship land in the middle of the battlefield in "Avengers: Endgame"?

How to preserve a rare version of a book?

Justification of physical currency in an interstellar civilization?

What are the requirements for a river delta to form?

While drilling into kitchen wall, hit a wire - any advice?



Comparing user sign up info in an array with user login input


Converting user input string to regular expressionPop up php table value to normal window combobox not working using javascriptHow to eval or parse jquery code that's pulled in as a .val() value?jquery window.click not working first timeHow to compare arrays in JavaScript?Handling client independent user logging inputHow to export JavaScript array info to csv (on client side)?keyup event not triggered for escape keyForm inputs have no cursor - jQuery UI in Chrome after htaccess loginHide/show an element based on value of var






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have two buttons: a sign up and a log in. I intend to collect the input form values from the sign up into an array (this works). I then want to compare the user input from the sign up with the user input from the login and notify the user that they are logged in. (I am yet to get started with localStorage and JSON. I want to get this done using arrays first).



I have tried using a for loop and if statements with logical operators (&&).



$(document).ready(function() 
$("#userSignUp").click(function()
$("#signUpForm").show();
$("#signup").hide();
);
$("#userInfo").click(function(event)

var custName = $("#newName").val();
var custEmail = $("#newEmail").val();
var custPass = $("#newPass").val();
var custData = [];
custData.push(custName, custEmail, custPass);
$("#userSignUp").text("Thank you for signing up!");
);
$("#userLogIn").click(function()
$("#loginForm").show();
$("#login").hide();
);
$("#userData").click(function(event)
var currentName = $("#userName").val();
var currentEmail = $("#userEmail").val();
var currentPass = $("#userPass").val();
for (var i = 0; i < custData.length; i++)
if ((currentName === custData[0]) && currentEmail === custData[1] && currentPass === custData[2])
$("#userLogIn").text("You are logged in!");
else
$("#userLogIn").text("Please enter correct name, email and password!");

;
);

);









share|improve this question




























    0















    I have two buttons: a sign up and a log in. I intend to collect the input form values from the sign up into an array (this works). I then want to compare the user input from the sign up with the user input from the login and notify the user that they are logged in. (I am yet to get started with localStorage and JSON. I want to get this done using arrays first).



    I have tried using a for loop and if statements with logical operators (&&).



    $(document).ready(function() 
    $("#userSignUp").click(function()
    $("#signUpForm").show();
    $("#signup").hide();
    );
    $("#userInfo").click(function(event)

    var custName = $("#newName").val();
    var custEmail = $("#newEmail").val();
    var custPass = $("#newPass").val();
    var custData = [];
    custData.push(custName, custEmail, custPass);
    $("#userSignUp").text("Thank you for signing up!");
    );
    $("#userLogIn").click(function()
    $("#loginForm").show();
    $("#login").hide();
    );
    $("#userData").click(function(event)
    var currentName = $("#userName").val();
    var currentEmail = $("#userEmail").val();
    var currentPass = $("#userPass").val();
    for (var i = 0; i < custData.length; i++)
    if ((currentName === custData[0]) && currentEmail === custData[1] && currentPass === custData[2])
    $("#userLogIn").text("You are logged in!");
    else
    $("#userLogIn").text("Please enter correct name, email and password!");

    ;
    );

    );









    share|improve this question
























      0












      0








      0








      I have two buttons: a sign up and a log in. I intend to collect the input form values from the sign up into an array (this works). I then want to compare the user input from the sign up with the user input from the login and notify the user that they are logged in. (I am yet to get started with localStorage and JSON. I want to get this done using arrays first).



      I have tried using a for loop and if statements with logical operators (&&).



      $(document).ready(function() 
      $("#userSignUp").click(function()
      $("#signUpForm").show();
      $("#signup").hide();
      );
      $("#userInfo").click(function(event)

      var custName = $("#newName").val();
      var custEmail = $("#newEmail").val();
      var custPass = $("#newPass").val();
      var custData = [];
      custData.push(custName, custEmail, custPass);
      $("#userSignUp").text("Thank you for signing up!");
      );
      $("#userLogIn").click(function()
      $("#loginForm").show();
      $("#login").hide();
      );
      $("#userData").click(function(event)
      var currentName = $("#userName").val();
      var currentEmail = $("#userEmail").val();
      var currentPass = $("#userPass").val();
      for (var i = 0; i < custData.length; i++)
      if ((currentName === custData[0]) && currentEmail === custData[1] && currentPass === custData[2])
      $("#userLogIn").text("You are logged in!");
      else
      $("#userLogIn").text("Please enter correct name, email and password!");

      ;
      );

      );









      share|improve this question














      I have two buttons: a sign up and a log in. I intend to collect the input form values from the sign up into an array (this works). I then want to compare the user input from the sign up with the user input from the login and notify the user that they are logged in. (I am yet to get started with localStorage and JSON. I want to get this done using arrays first).



      I have tried using a for loop and if statements with logical operators (&&).



      $(document).ready(function() 
      $("#userSignUp").click(function()
      $("#signUpForm").show();
      $("#signup").hide();
      );
      $("#userInfo").click(function(event)

      var custName = $("#newName").val();
      var custEmail = $("#newEmail").val();
      var custPass = $("#newPass").val();
      var custData = [];
      custData.push(custName, custEmail, custPass);
      $("#userSignUp").text("Thank you for signing up!");
      );
      $("#userLogIn").click(function()
      $("#loginForm").show();
      $("#login").hide();
      );
      $("#userData").click(function(event)
      var currentName = $("#userName").val();
      var currentEmail = $("#userEmail").val();
      var currentPass = $("#userPass").val();
      for (var i = 0; i < custData.length; i++)
      if ((currentName === custData[0]) && currentEmail === custData[1] && currentPass === custData[2])
      $("#userLogIn").text("You are logged in!");
      else
      $("#userLogIn").text("Please enter correct name, email and password!");

      ;
      );

      );






      javascript jquery html css bootstrap-4






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 23 at 4:59









      AbbyAbby

      12




      12






















          2 Answers
          2






          active

          oldest

          votes


















          0














          May be you could try only IF statement without the loop.
          The following thing checks if there is such item in the array and if it IS, will do smth:



          if (custData.indexOf(currentName) != -1 
          && custData.indexOf(currentEmail) != -1
          && custData.indexOf(currentPass) != -1)
          $("#userLogIn").text("You are logged in!");
          else {
          $("#userLogIn").text("Please enter correct name, email and password!");





          share|improve this answer























          • Hey Daniel, tried, doesn't work

            – Abby
            Mar 28 at 7:02


















          0














          I have been learning about localStorage. I decided to use it on this task. I collected the values that the user inputs when signing up, and 'saved' them on local Storage. I then collected the value the user inputs and 'retrieved' them via local Storage. Here is the code:



          $(document).ready(function() 
          $("#userSignUp").click(function()
          $("#signUpForm").show();
          $("#signup").hide();
          );
          $("#userInfo").click(function(event)
          var custName = $("#newName").val();
          var custEmail = $("#newEmail").val();
          var custPass = $("#newPass").val();
          localStorage.setItem("name", "Raych") +
          localStorage.setItem("email", "raych@gmail.com") +
          localStorage.setItem("password", "hey"); ;
          $("#userSignUp").text("Thank you for signing up!");
          );
          $("#userLogIn").click(function()
          $("#loginForm").show();
          $("#login").hide();
          );
          $("#userData").click(function(event)
          event.PreventDefault;
          var currentName = $("#userName").val();
          var currentEmail = $("#userEmail").val();
          var currentPass = $("#userPass").val();
          localStorage.getItem("name") +
          localStorage.getItem("email") +
          localStorage.getItem("password");
          $("#userLogIn").text("You are logged in!");
          );
          );





          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55310759%2fcomparing-user-sign-up-info-in-an-array-with-user-login-input%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            May be you could try only IF statement without the loop.
            The following thing checks if there is such item in the array and if it IS, will do smth:



            if (custData.indexOf(currentName) != -1 
            && custData.indexOf(currentEmail) != -1
            && custData.indexOf(currentPass) != -1)
            $("#userLogIn").text("You are logged in!");
            else {
            $("#userLogIn").text("Please enter correct name, email and password!");





            share|improve this answer























            • Hey Daniel, tried, doesn't work

              – Abby
              Mar 28 at 7:02















            0














            May be you could try only IF statement without the loop.
            The following thing checks if there is such item in the array and if it IS, will do smth:



            if (custData.indexOf(currentName) != -1 
            && custData.indexOf(currentEmail) != -1
            && custData.indexOf(currentPass) != -1)
            $("#userLogIn").text("You are logged in!");
            else {
            $("#userLogIn").text("Please enter correct name, email and password!");





            share|improve this answer























            • Hey Daniel, tried, doesn't work

              – Abby
              Mar 28 at 7:02













            0












            0








            0







            May be you could try only IF statement without the loop.
            The following thing checks if there is such item in the array and if it IS, will do smth:



            if (custData.indexOf(currentName) != -1 
            && custData.indexOf(currentEmail) != -1
            && custData.indexOf(currentPass) != -1)
            $("#userLogIn").text("You are logged in!");
            else {
            $("#userLogIn").text("Please enter correct name, email and password!");





            share|improve this answer













            May be you could try only IF statement without the loop.
            The following thing checks if there is such item in the array and if it IS, will do smth:



            if (custData.indexOf(currentName) != -1 
            && custData.indexOf(currentEmail) != -1
            && custData.indexOf(currentPass) != -1)
            $("#userLogIn").text("You are logged in!");
            else {
            $("#userLogIn").text("Please enter correct name, email and password!");






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 23 at 5:15









            Daniel DeulinDaniel Deulin

            316




            316












            • Hey Daniel, tried, doesn't work

              – Abby
              Mar 28 at 7:02

















            • Hey Daniel, tried, doesn't work

              – Abby
              Mar 28 at 7:02
















            Hey Daniel, tried, doesn't work

            – Abby
            Mar 28 at 7:02





            Hey Daniel, tried, doesn't work

            – Abby
            Mar 28 at 7:02













            0














            I have been learning about localStorage. I decided to use it on this task. I collected the values that the user inputs when signing up, and 'saved' them on local Storage. I then collected the value the user inputs and 'retrieved' them via local Storage. Here is the code:



            $(document).ready(function() 
            $("#userSignUp").click(function()
            $("#signUpForm").show();
            $("#signup").hide();
            );
            $("#userInfo").click(function(event)
            var custName = $("#newName").val();
            var custEmail = $("#newEmail").val();
            var custPass = $("#newPass").val();
            localStorage.setItem("name", "Raych") +
            localStorage.setItem("email", "raych@gmail.com") +
            localStorage.setItem("password", "hey"); ;
            $("#userSignUp").text("Thank you for signing up!");
            );
            $("#userLogIn").click(function()
            $("#loginForm").show();
            $("#login").hide();
            );
            $("#userData").click(function(event)
            event.PreventDefault;
            var currentName = $("#userName").val();
            var currentEmail = $("#userEmail").val();
            var currentPass = $("#userPass").val();
            localStorage.getItem("name") +
            localStorage.getItem("email") +
            localStorage.getItem("password");
            $("#userLogIn").text("You are logged in!");
            );
            );





            share|improve this answer



























              0














              I have been learning about localStorage. I decided to use it on this task. I collected the values that the user inputs when signing up, and 'saved' them on local Storage. I then collected the value the user inputs and 'retrieved' them via local Storage. Here is the code:



              $(document).ready(function() 
              $("#userSignUp").click(function()
              $("#signUpForm").show();
              $("#signup").hide();
              );
              $("#userInfo").click(function(event)
              var custName = $("#newName").val();
              var custEmail = $("#newEmail").val();
              var custPass = $("#newPass").val();
              localStorage.setItem("name", "Raych") +
              localStorage.setItem("email", "raych@gmail.com") +
              localStorage.setItem("password", "hey"); ;
              $("#userSignUp").text("Thank you for signing up!");
              );
              $("#userLogIn").click(function()
              $("#loginForm").show();
              $("#login").hide();
              );
              $("#userData").click(function(event)
              event.PreventDefault;
              var currentName = $("#userName").val();
              var currentEmail = $("#userEmail").val();
              var currentPass = $("#userPass").val();
              localStorage.getItem("name") +
              localStorage.getItem("email") +
              localStorage.getItem("password");
              $("#userLogIn").text("You are logged in!");
              );
              );





              share|improve this answer

























                0












                0








                0







                I have been learning about localStorage. I decided to use it on this task. I collected the values that the user inputs when signing up, and 'saved' them on local Storage. I then collected the value the user inputs and 'retrieved' them via local Storage. Here is the code:



                $(document).ready(function() 
                $("#userSignUp").click(function()
                $("#signUpForm").show();
                $("#signup").hide();
                );
                $("#userInfo").click(function(event)
                var custName = $("#newName").val();
                var custEmail = $("#newEmail").val();
                var custPass = $("#newPass").val();
                localStorage.setItem("name", "Raych") +
                localStorage.setItem("email", "raych@gmail.com") +
                localStorage.setItem("password", "hey"); ;
                $("#userSignUp").text("Thank you for signing up!");
                );
                $("#userLogIn").click(function()
                $("#loginForm").show();
                $("#login").hide();
                );
                $("#userData").click(function(event)
                event.PreventDefault;
                var currentName = $("#userName").val();
                var currentEmail = $("#userEmail").val();
                var currentPass = $("#userPass").val();
                localStorage.getItem("name") +
                localStorage.getItem("email") +
                localStorage.getItem("password");
                $("#userLogIn").text("You are logged in!");
                );
                );





                share|improve this answer













                I have been learning about localStorage. I decided to use it on this task. I collected the values that the user inputs when signing up, and 'saved' them on local Storage. I then collected the value the user inputs and 'retrieved' them via local Storage. Here is the code:



                $(document).ready(function() 
                $("#userSignUp").click(function()
                $("#signUpForm").show();
                $("#signup").hide();
                );
                $("#userInfo").click(function(event)
                var custName = $("#newName").val();
                var custEmail = $("#newEmail").val();
                var custPass = $("#newPass").val();
                localStorage.setItem("name", "Raych") +
                localStorage.setItem("email", "raych@gmail.com") +
                localStorage.setItem("password", "hey"); ;
                $("#userSignUp").text("Thank you for signing up!");
                );
                $("#userLogIn").click(function()
                $("#loginForm").show();
                $("#login").hide();
                );
                $("#userData").click(function(event)
                event.PreventDefault;
                var currentName = $("#userName").val();
                var currentEmail = $("#userEmail").val();
                var currentPass = $("#userPass").val();
                localStorage.getItem("name") +
                localStorage.getItem("email") +
                localStorage.getItem("password");
                $("#userLogIn").text("You are logged in!");
                );
                );






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 9 at 10:20









                AbbyAbby

                12




                12



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55310759%2fcomparing-user-sign-up-info-in-an-array-with-user-login-input%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript