962 posts
  • 8 Years of Membership
  • Author Level 3
  • Beta Tester
  • Collector Level 2
+7 more

Hey everyone, I’m kind of having some troubles. I have built a login form with the register page built into the same login page. There is a jquery slider, so if they click “login” it will slide to the login form. If they click the “register” link , it will slide to the register form.

The problem I am having is submitting the forms. I am validating both forms, but say I fill out the register form, it will slide back to the login form and ask to type in an email and password.

So I’m wondering if there is a type of code that does this:

If the register submit button is clicked it will only verify the register form. And if the login submit button is clicked it will only validate the login form.

I really like the effect with the two forms on the same page, but I really want to get them both working properly.

Thanks for any help you can provide me with!

73 posts
  • 6 Years of Membership
  • Author Level 2
  • Beta Tester
  • Collector Level 4
+4 more

I’m doing something very similar, actually. It’s a problem with the IDs and the Names of the fields…...you’ll have to differentiate them somehow….. I haven’t finished the project yet, but I should start working on that part tomorrow.

I’ll be interested in this thread for sure.

404 posts
  • Featured Item
  • Trendsetter
  • Weekly Top Seller
  • Author Level 6
+10 more

Does the jquery make the slide back or the backend code ? Like @jalessmith writes it’s the id’s and the name of the filelds. Sent me you html code (or post all the code here) and I will have a look and advice what to change.

102 posts
  • 7 Years of Membership
  • Affiliate Level 1
  • Author Level 5
  • Collector Level 4
+6 more


Without seeing the page code, I can only offer a broad answer / advice.

as mentioned, it is all in the ids of your page elements. HTML id’s are there specifically for this reason, so that you additional code / scripts can look for / target values in specific elements of the page.

I am not sure whether you are doing this all via JS + Ajax for the validation, if that is the case that my example will get very generalised.

For php validation, you should simply need to look for a specific submit variable id, so for example, if you had 2 submit buttons, one with an id of “login” and another with an id of “register”, you would need to add some code like this to your php header :

if(isset($_POST['register'])) {
     // register user
} elseif(isset($_POST['login'])) {
     // log user in

Javascript / ajax would use similar logic, just slightly different implementation.

$('#login').click(function() {
    // login stuff
$('#register').click(function() {
    // register stuff

Thats just a brief how to off the top of my head, if I have gone down the wrong road, then I apologize :) although some sample code / example page would help people give you a nailed down answer :)