The problem is, you're changing the name of the field in the HTML, but the server-side data model is still expecting a variable named "username" (which is the name of the field in the database table). I suppose a workaround might be something like this in the controller (before:
if request.post_vars.regForm_username: request.post_vars.username = request.post_vars.regForm_username registrationForm = auth.register() That way, the expected "username" variable will be included in request.post_vars. Can you show an example of a jQuery/Ajax problem with fields in different forms having the same name? Can't you just put each form inside a div with a unique id and include the id in the jQuery selectors? Anthony On Friday, August 24, 2012 5:23:40 PM UTC-4, shartha wrote: > > This is in my controller: > registrationForm = auth.register() > UN = registrationForm.element("#user_username") > UN["_placeholder"] = "Username" > UN["_name"] = "regForm_username" # This is what causes the error. > > and this is in my view: > > {{=registrationForm}} > > The registraionForm does not allow me to register a new user if the line > that changes the name of the #user_username id exists in the controller. > Once you remove it, the registration form starts to work fine. The same > occurs with the login form. If you change the name of the username or > password field, it doesn't allow you to log in. > > > The reason I'd like to change the name of the username field is that it is > the same as the one on the login form, and if you happen to have both on > the same page, you may encounter issues with jQuery/Ajax functions that > pass along their values. > > > > On Tuesday, August 14, 2012 10:51:12 PM UTC-7, shartha wrote: >> >> Hello, >> Quick question: >> Instead of {{=auth.login()}}, I am using the following to be able to >> customize my login form. However the resulting form does not work and I >> cannot login with the same username/password that enable me to login if I >> had used {{=auth.login()}} -- I get the flash error: Invalid Login. >> >> Could someone please tell me what's possibly going wrong? Thanks! >> >> {{form=auth.login()}} >> {{=form.custom.begin}} >> Username: >> {{=form.custom.widget.username}} >> </br> >> Password: >> {{=form.custom.widget.password}} >> {{=form.custom.submit}} >> {{=form.custom.end}} >> > --