Thanks, A good trick.
Almost does what I want. Problem below. Well spoken Merico Raffaele <[email protected]> wrote: >Hi Edward > >To access the entered value in a CForm I use the following construct based >on a personal server side javascript function. > ><fd:field id=3D"form_bis" required=3D"false"> > <fd:datatype base=3D"date"> > ...=09 > </fd:datatype> > <fd:validation> > <fd:javascript> > return checkFormInputDate(widget); > </fd:javascript> > </fd:validation> ></fd:field> > > >function checkFormInputDate (widget, regExpValidation, >regExpValidationError) >{ >=09 > var enteredValue =3D new >String(cocoon.request.getParameter(widget.getRequestParameterName())); > ... >} Let's say you have a date like 0/0/0, you detect its bogousity in your fd:validation and display an error message. Meanwhile your date field just became 11/30/0002, because the conversion went on and reinitializes the field. The user looks casually (or is fixing a bunch of other RED EXCLAMATION MARKS above) and resubmits the form. Now the date field is validated, but not what the user typed in the first time, and not what they would have fixed it to. For this to work I need to keep the control of the field in the user's hands and not have the system make a wild guess. Thanks for the trick though, Ed Elhauge >Raffaele > >-----Urspr=FCngliche Nachricht----- >Von: Edward Elhauge [mailto:[email protected]]=20 >Gesendet: Mittwoch, 4. Februar 2009 02:05 >An: [email protected] >Betreff: [?? Probable Spam] More control over Cform Date Conversion > >Hi, > >I've run into a problem where my users want more detailed control over >Date field validation. In the version that we're running (2.1.8) >we don't have a "lenient" attribute for base=3D"date" widgets. > >So the user can type in "33/60/9z" as a date, which get converted into >"10/30/2011". Not what was expected. > >What I'd like would be to a small: > <fd:validation> <fd:javascript> > ... > </fd:javascript> </fd:validation> >section to throw an error in those cases. > >Unfortunately this.value inside that javascript callback is already in a >Date format. > >My question is: > How do I get access to the users original text input > within the fd:validation section? > > If there is no way to get access to the raw text, do I need to write > my own validator to replace "FormattingDateConvertor" ? -- Edward Elhauge <[email protected]> "The right dose differentiates a poison and a remedy." -- Paracelsus (1493 - 1541) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
