I'm guessing that was never supposed to work. I think the 'type' argument 
to Field() is only supposed to take one of the DAL's pre-defined types. In 
the past this worked because without specifying a widget or one of the 
recognized field types, the field was given the string widget by default, 
and the string widget previously didn't assign a specific class, so just 
adopted the field's 'type' as the class. In 1.99.3, the string widget 
explicitly assigns a class="string", so now ignores the field's 'type'.

If you want to add hidden fields, you're supposed to do so via the 'hidden' 
argument -- see the end of this 
section: http://web2py.com/book/default/chapter/07#SQLFORM

Anthony

On Monday, December 12, 2011 8:21:42 PM UTC-5, Jim Karsten wrote:
>
> SQLFORM.factory hidden fields are not working the same in 1.99.3 as in 
> 1.99.2. Here is a simple example 
> form = SQLFORM.factory( 
> Field('text_field'), 
> Field('hidden_field', type='hidden', default='test'),) 
>
> The hidden field is not hidden. Here is the html produced. The first is 
> from 1.99.2, the second 1.99.3. 
>
> <input id="no_table_hidden_field" class="hidden" type="text" value="test" 
> name="hidden_field" style="display: none;"> 
> <input id="no_table_hidden_field" class="string" type="text" value="test" 
> name="hidden_field"> 
>
> If I use readable=False, writable=False, the field is hidden from the 
> display but then no input is created for it. I have javascript code 
> accessing the hidden input value. I can probably work around the problem 
> using this syntax. 
>
> form = SQLFORM.factory( 
> Field('text_field'), 
> hidden={'hidden_field': 'test'}) 
>
> However, the input produced has no id or class attribute which I was 
> using. 
>
> <input value="test" name="hidden_field" type="hidden"> 
>
> Is what I'm seeing a bug or was the Field(... type='hidden'...) syntax 
> never intended to work? 

Reply via email to