Thank you, I see what you are saying and will test the jQuery examples.

Ideally, I'd like to predefine the validation code and just specify a mask when the field is declared in the Field statement (DRY). Then forms would inherit the value and use the appropriate jQuery code for those fields.

Thanks!

On Mon, 19 Aug 2013, Massimo Di Pierro wrote:

web2py does this automatically for some fields (integer, float, decimal). It 
prevents you from typing invalid chars and also validates serverside for 
security. It very easy to add other
types of client-size typing restrictions by using the examples. For example for 
integer:
jQuery(document).on('keyup', 'input.integer', function () {
        this.value = this.value.reverse().replace(/[^0-9\-]|\-(?=.)/g, 
'').reverse();
});



On Sunday, 18 August 2013 17:00:28 UTC-5, wb wrote:
      Hello.  I'm just starting to dig into web2py.  One thing I really want
      is field input masks ala Visual Foxpro, to prevent users from entering
      invalid characters rather than validating afterwards and telling them
      they made a mistake.

      For example, if a user types alpha characters into a numeric-only field,
      they do not even appear.  A field that is uppercase alpha would convert
      a lowercase "a" to "A" as the user types.  VFP input masks could do
      complex things with combinations of wildcard and static characters, like
      "999-999-9999", where the 9 allows a numeric digit, but the dashes are
      automatically inserted in the string when the user reaches that point.

      Some searching did not find anything concrete.  Is there a plugin or
      some other standard way of doing least basic input formatting as the
      user enters data in a field?

      Thanks!

--

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



--

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