So this little bit of code solved my problem:

elements_with_auth_user_ids = login_form.elements(_id=re.compile(
'^auth_user'))
for x in elements_with_auth_user_ids:
    x['_id']= "login_" + x['_id']

Using regex with the elements method, found all the ID's starting with 
"auth_user", and added a "login_" user prefix. This prevents having 
duplicate ID's on the page (b/c I have the register form on the same page).

On Monday, August 18, 2014 9:43:47 AM UTC-7, Mark Li wrote:
>
> I am currently trying to alter all the ID's of the elements in the 
> auth.login() form. Basically, I want to add a prefix or suffix to all the 
> elements that have an ID.
>
> All of the id's (except for the submit button row), are prefixed with 
> "auth_user_". Is it possible to use form.elements() to select all those 
> elements at once?
>
> I tried using a css3 substring selector, like 
>
> login_form.elements('[id*="auth_user"]')
>
> but this selected a few extra elements that did not have the auth_user ID 
> prefix. Is there an efficient way to accomplish this? 
>
> As a last resort, I can change the ID's of each element individually
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to