How can I assign an id attribute to a hidden form field?

I've create a form with a hidden field 'interval' like this:

f=SQLFORM(db.mytable, hidden=dict(interval='year'))

I want to manipulate the value of that field in Javascript, so want to 
assign a known id to the field in order to reference it. I've tried the 
following, but the id isn't coming out in the XML:

>>> f.hidden_fields().element('input[name=interval]').update(_id=
'form_interval')
<gluon.html.INPUT object at 0xb744952c>
>>> f.hidden_fields().element('input[name=interval]').xml()
'<input name="interval" type="hidden" value="year" />

>>> f.hidden_fields().element('input[name=interval]')['_id'] = 
'form_interval'
>>> f.hidden_fields().element('input[name=interval]').xml()
'<input name="interval" type="hidden" value="year" />'

I have assigned id's to other fields in the form using 
f.custom.widget.<field>.update(_id='form_myid'). How can I give the hidden 
field an id?

Thanks,
John

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