I'm well into the development of my commercial website and I find I am 
running afoul of the built-in javascript validators in web2py more and more.

If the validators were useless, the decision to just cut them out of the 
code and be done with it would be easy and simple.  But they do have their 
usefulness, although in far less than 100% of the cases.  Therein lies the 
problem.

In my application I'm treating amounts as an integer -- a fairly common 
practice since real numbers do a poor job at representing exact amounts. 
 So all amounts are stored internally as pennies and I have a custom 
validator that converts them to dollars and back for display.  You can 
already sense the problem coming...  The field is, of course, an integer. 
 That triggers the automagic web2py javascript validator that prevents any 
decimal numbers from being entered.  ANYWHERE.

Yes, I can fix it on my forms.  I can change the class of the inputs after 
they're built.  Again and again.  But suppose I need to make a quick entry 
thru the appadmin interface?  Bzzzzt!  Thanks for playing -- you can't 
enter cents at all in that interface because the automagic javascript 
validator is in full force inside appadmin.

Dates are another vexing issue.  The calendar gadget is cute in small 
doses, but it starts to wear thin when you realize we need to support 
different locales, different color schemes, etc.  So I guess we need to 
implement the whole jQuery "theming" thing just to make the calendar match 
the rest of the site.  I still haven't found the best answer for default 
"M-D-Y" entry instead of "Y-M-D".

Maybe the Field constructor should have a different entry for the SQL class 
of the field and its INPUT class.  That way I could have a DB field of 
"integer" and choose to call it "money" when it is built as an INPUT 
control.  At least it would make it easier to avoid the automagic 
validation.  The INPUT class could default to the SQL class for backwards 
compatibility, but it would make it easier to start providing our own 
validators and skipping the built in ones.

-- 

--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to