962 posts
  • Has been part of the Envato Community for over 5 years
  • Has sold $1,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+5 more
webdesigndeluxe says

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
  • Has been part of the Envato Community for over 4 years
  • Has sold $100+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 100+ items on Envato Market
+2 more
jalexsmith says

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.

329 posts
  • Has referred 50+ members
  • Has sold $10,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Had an item featured in an Envato Bundle
+7 more
ceasar says

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
  • Has been part of the Envato Community for over 4 years
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+4 more
RyanDavies says

Hi

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 :)

Ryan

by
by
by
by
by
by