That makes sense, thank you!

On Sat, Oct 5, 2013 at 12:53 AM, Barry Books <trs...@gmail.com> wrote:

> It has this method
>
> *public* *void* render(Field field, String message, MarkupWriter writer,
> FormSupport formSupport) {
>
>
>  }
>
>
> which gives you the field, the form and a writer to the element. I use it
> to write data- attributes into the html markup and then the javascript can
> access them. I think your simple example could be solved by either method
> but with a validator you could write min="1" and max="10" into the element
> and then use javascript enforce that. The translator could also support
> this on the server side when it parses the client data.
>
>
> On Fri, Oct 4, 2013 at 10:24 AM, Ilya Obshadko <ilya.obsha...@gmail.com
> >wrote:
>
> > On Fri, Oct 4, 2013 at 8:17 PM, Barry Books <trs...@gmail.com> wrote:
> >
> > > You might be able to do this with a translator instead of a validator.
> > They
> > > are really for converting data but you can also throw validation
> > > exceptions, access the current field and add data to the html element.
> > >
> >
> > Does translator really have JS hooks I could use?
> >
> >
> > > On Fri, Oct 4, 2013 at 1:51 AM, Ilya Obshadko <ilya.obsha...@gmail.com
> > > >wrote:
> > >
> > > > Hello,
> > > >
> > > > Is that possible to create a custom validator that is
> > context-dependent?
> > > > That is, I want validation logic (including client-side JS) to depend
> > on
> > > > actual component data.
> > > >
> > > > I have checked
> > > http://wiki.apache.org/tapestry/Tapestry5HowToAddValidators
> > > > ,
> > > > it's pretty clear how to do that, but I don't have any idea how do I
> > > inject
> > > > actual component data into validator when needed.
> > > >
> > > > Thanks in advance!
> > > >
> > > > --
> > > > Ilya Obshadko
> > > >
> > >
> >
> >
> >
> > --
> > Ilya Obshadko
> >
>



-- 
Ilya Obshadko

Reply via email to