joe,

about the money validator - if you set widget *and* requires on the Field 
object then you won't have the default integer validator.  just make sure 
that your validator converts the string/decimal number to an int so that it 
can be stored in the DB (which expects an int).

good luck!

cfh

On Sunday, August 25, 2013 12:42:27 PM UTC-7, Joe Barnhart wrote:
>
> I seem to keep underestimating the widget classes and their power.  
>
> Reading the code I can see that widgets pretty much "own" the fields and 
> their representation in all respects.  I can change input class, 
> "represents", "requires" and pretty much anything else the Field needs to 
> show itself.
>
> class MoneyWidget(StringWidget):
>     _class = 'money'
>     ...etc...
>
> Some custom widgets and I think I'll be in business -- plus I can 
> selectively use or not use the javascript validators where I want.
>
> EDIT:
>
> Oope.  It isn't simple after all.  The form processing adds its OWN 
> validators according to... you guessed it... the "type" of the FIELD.  In 
> my case, I've changed the INPUT type to "money" but the FIELD type is still 
> "integer" (as required by SQL) so the automatic integer validator gets 
> added to my "money" validator and fails every attempt to edit the field in 
> appadmin.  I see no way to defeat the "AUTOTYPES" used in "dictform" which 
> in turn is used by appadmin.
>
> Sometimes these automatic "helpers" are really a pain in the rear.  it is 
> one of the few places where web2py falls down just a bit.
>
> -- Joe 
>
> On Sunday, August 25, 2013 7:00:54 AM UTC-7, Anthony wrote:
>>
>> Also, note that in this case, I think you can just do:
>>
>> Field('myfield', 'integer',
>>       widget=SQLFORM.widgets.string.widget)
>>
>> Anthony
>>
>>

-- 

--- 
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/groups/opt_out.

Reply via email to