Kudos. This is a bug! Massimo
On May 21, 1:49 am, Alexey Nezhdanov <[email protected]> wrote: > Ok, here I encountered another related problem. > I use an ajax form to dynamically lookup some data. > Namely - that is city name and longtitude/latitude. > jquery shows to the user if something he typed in has a lat/lon pair > in the db or it has not. > if db doesn't contain that pair - user have to specify it on the map > (thanks openstreetmap.org). > On submit jquery puts the lat/lon from the map to the hidden fields > (which I add to the form in the controller). > > BUT. If form,accepts() returns false because of any reason - > I do receive lat/lon values in form.vars but on subsequent form > display hidden fields are empty. > IOW - INPUT._traverse for the hidden field doesn't set the '_value'. > It only sets the 'value' but you consider it to be invalid element for > a hidden field. > For now I solved my problem this way: > +++gluon/html.py @line 701 def _validate(self): > self['value'] = value > + if self['_type'] == 'hidden': self['_value'] = value > requires = self['requires'] > > So is it still just inconsistency in manual? > > On May 19, 5:22 pm, mdipierro <[email protected]> wrote: > > > This is simply an undocumented issue and it is correct. > > _value is the tag attribute and it works as expected. > > value is for internal use and it contain the current value of an input > > field that is to be set by the user. hidden input fields ignore value > > because they only have a _value. I will try exmplain this better in > > the next version of the manual. > > > On May 19, 7:36 am, Alexey Nezhdanov <[email protected]> wrote: > > > > Hello > > > Please notice this difference: > > > > >>> print INPUT(_type='hidden', value='test') > > > > <input type="hidden" />>>> print INPUT(_type='text', value='test') > > > > <input type="text" value="test" /> > > > > and at the same time:>>> print INPUT(_type='text',_value='test') > > > > <input type="text" value="test" />>>> print > > > INPUT(_type='hidden',_value='test') > > > > <input type="hidden" value="test" /> > > > > Yet INPUT's docstring recommends using '_value' over 'value'. This is > > > either a bug or just undocumented inconsistency. > > > > -- > > > Regards > > > Alexey > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

