soundsticks Posted March 27, 2013 Share Posted March 27, 2013 Currently I'm using Ajax to do the register validation, but I feel if the internet connection is not in good performance, sometime the Ajax is not working and it did make user register with the same username. So how can I do the double checking register validation. Link to comment https://forums.phpfreaks.com/topic/276209-double-validation-php-and-ajax/ Share on other sites More sharing options...
haku Posted March 27, 2013 Share Posted March 27, 2013 Step 1: Add Javascript validation that validates after the user is finished inserting info. Step 2: Add PHP to check the submitted data when the user submits the form. Link to comment https://forums.phpfreaks.com/topic/276209-double-validation-php-and-ajax/#findComment-1421330 Share on other sites More sharing options...
soundsticks Posted March 27, 2013 Author Share Posted March 27, 2013 Step 1: Add Javascript validation that validates after the user is finished inserting info. Step 2: Add PHP to check the submitted data when the user submits the form. But I'm using Ajax already on my register form and when user try to select/insert the user that he wish it will show whether the username is available or taken by others. Link to comment https://forums.phpfreaks.com/topic/276209-double-validation-php-and-ajax/#findComment-1421331 Share on other sites More sharing options...
haku Posted March 27, 2013 Share Posted March 27, 2013 Then you only need to add step 2. Link to comment https://forums.phpfreaks.com/topic/276209-double-validation-php-and-ajax/#findComment-1421332 Share on other sites More sharing options...
Psycho Posted March 27, 2013 Share Posted March 27, 2013 Step 1: Add Javascript validation that validates after the user is finished inserting info. Step 2: Add PHP to check the submitted data when the user submits the form. I have to disagree slightly. Server-side validation should be #1 and a requirement. Client-side validation is a "nice to have" but not a necessity, so it should be considered #2. Link to comment https://forums.phpfreaks.com/topic/276209-double-validation-php-and-ajax/#findComment-1421340 Share on other sites More sharing options...
haku Posted March 27, 2013 Share Posted March 27, 2013 You aren't disagreeing with me, in that my list wasn't a list of priorities, it was a list of steps. And there is nothing wrong with reversing those two steps. Link to comment https://forums.phpfreaks.com/topic/276209-double-validation-php-and-ajax/#findComment-1421346 Share on other sites More sharing options...
DaveyK Posted March 27, 2013 Share Posted March 27, 2013 Client side validation is markup (great for validating charsets and such), server side validation is real deal. However, the signup issue you describe only occurs on ajax calls and not when you try to do it via the traditional method? One method that always work is just making the user name unique in the database table, its not that pretty though (you'd run an UPDATE IGNORE and check how many rows were actually affected to see if the add worked). Link to comment https://forums.phpfreaks.com/topic/276209-double-validation-php-and-ajax/#findComment-1421353 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.