* Simone Gianni <simo...@apache.org> wrote on [2009-02-03 17:25]:
> Hi Edward,
> the problem is in conversion, not in validation. When a form value is 
> filled by the user, it is a plain string. Then it arrives to Cocoon, 
> that parse the string to convert it to the proper type, for example a 
> date. After that conversion has been performed successfully, then 
> validation is performed on the obtained converted value, for example the 
> Date object.
> 
> So, it is not possible to check the string value from a validator, 
> unless you are trying on a string field :)

That's what I figured when I started poking about, but I was hoping
that the original user input was tucked away somewhere in the Widget.
 
> You should be able to take the java source code of the date converter 
> from a recent 2.1.x version of Cocoon, a version that supports the 
> lenient attribute, and backport it to the 2.1.8 version.

So I basically have to roll my own replacement "FormattingDateConvertor",
which I can crib from a more recent version.
 
> Hope this helps,
> Simone

Yes, thank you. Knowing that you can stop looking is a BIG help.

Cheers,

Ed Elhauge
 
> Edward Elhauge wrote:
> >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="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" ?
> >
> >  
> 
> 
> -- 
> Simone Gianni            CEO Semeru s.r.l.           Apache Committer
> http://www.simonegianni.it/
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
> For additional commands, e-mail: users-h...@cocoon.apache.org
---end quoted text---

-- 
        Edward Elhauge <e...@uncanny.net>
"The right dose differentiates a poison and a remedy." -- Paracelsus (1493 - 
1541)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org

Reply via email to