[Seaside] JavaScript input mask/validator

cdrick cdrick65 at gmail.com
Thu Jan 31 14:41:17 UTC 2008

uhm this one seems pretty cool
(http://javascript.internet.com/forms/input-mask.html), based on
prototype and just need a css class when rendered so as to have:
<td>Phone number:</td>
<td><input id="input_phone" type="text" class="text input_mask mask_phone"></td>

you then have to implement your filter in js... not very smalltakish
until some port was done


   /* Each mask has a format and regex property.  The format consists
    * of spaces and non-spaces.  A space is a placeholder for a value the user
    * enters.  A non-space is a literal character that gets copied to that
    * position in the value.  The regex is used to validate each character, one
    * at a time (it is not applied against the entire value in the form field,
    * just the characters the user enters).
    * The way you name your masks is significant.  If you create a mask called
    * date_us, you cause it to be applied to a form field by a) adding the
    * input_mask class to that form field, which triggers this script to treat
    * it specially, and b) adding the class mask_date_us to the form field,
    * which causes this script to apply the date_us mask to it.
   masks: {
      date_iso: {
         format: '    -  -  ',
         regex:  /\d/

More information about the seaside mailing list