You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Dmitriy Vsekhvalnov <dv...@gmail.com> on 2013/04/04 12:40:56 UTC

Mixin to overwrite input field value?

Hi everyone,

  is it possible to have mixin which will intercept form submission (on T5
side, not in browser) and overwrite input field value coming from client,
before the value bound to input's property?

I'm using maskedit mixing for inputs, but for some values i want unmasked
data to go to database.

Re: Mixin to overwrite input field value?

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 04 Apr 2013 12:16:37 -0300, Dmitriy Vsekhvalnov  
<dv...@gmail.com> wrote:

> ..and to complicate things more: T5.1.0.18 ? :) don't ask me to upgrade,
> i'm locked, because tapestry never compatible with previous versions.

Trolling or repeating way old stuff won't get you much help here. Anyway,  
the answer for you problem is already given, implement your own Validator.

-- 
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Mixin to overwrite input field value?

Posted by Dmitriy Vsekhvalnov <dv...@gmail.com>.
..and to complicate things more: T5.1.0.18 ? :) don't ask me to upgrade,
i'm locked, because tapestry never compatible with previous versions.


On Thu, Apr 4, 2013 at 5:07 PM, Thiago H de Paula Figueiredo <
thiagohp@gmail.com> wrote:

> On Thu, 04 Apr 2013 09:37:12 -0300, Dmitriy Vsekhvalnov <
> dvsekhvalnov@gmail.com> wrote:
>
>  Little bit confused.. can mixin bind translator to textfield?
>>
>
> Check @BindParameter
>
>
>  Or can translator attach javascript after render?
>>
>
> Yes, you can. See Validator.render(Field field, C constraintValue,
> MessageFormatter formatter, MarkupWriter writer,         FormSupport
> formSupport)
>
> --
> Thiago H. de Paula Figueiredo
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<us...@tapestry.apache.org>
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Mixin to overwrite input field value?

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 04 Apr 2013 09:37:12 -0300, Dmitriy Vsekhvalnov  
<dv...@gmail.com> wrote:

> Little bit confused.. can mixin bind translator to textfield?

Check @BindParameter

> Or can translator attach javascript after render?

Yes, you can. See Validator.render(Field field, C constraintValue,  
MessageFormatter formatter, MarkupWriter writer,         FormSupport  
formSupport)

-- 
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Mixin to overwrite input field value?

Posted by Dmitriy Vsekhvalnov <dv...@gmail.com>.
Little bit confused.. can mixin bind translator to textfield? Or can
translator attach javascript after render?

I'll give example of what i want in general:

<input t:type="textfield" t:mixins="maskededit" t:mask="+9-(999)-999-99-99?
#99-99-99" t:id="phone" t:bind-unmasked="true"  t:value="profile.phone" />

which should attach JS to textfield to allow masked input with given mask,
but bind unmasked value to profile.phone property.



On Thu, Apr 4, 2013 at 3:30 PM, Geoff Callender <
geoff.callender.jumpstart@gmail.com> wrote:

> Have you looked into using a translator instead of a mixin?
>
>
> http://jumpstart.doublenegative.com.au/jumpstart/examples/input/contributingtranslators
>         Example (4) in
> http://jumpstart.doublenegative.com.au/jumpstart/examples/input/augmentingtranslators
>
> Geoff
>
> On 04/04/2013, at 9:40 PM, Dmitriy Vsekhvalnov wrote:
>
> > Hi everyone,
> >
> >  is it possible to have mixin which will intercept form submission (on T5
> > side, not in browser) and overwrite input field value coming from client,
> > before the value bound to input's property?
> >
> > I'm using maskedit mixing for inputs, but for some values i want unmasked
> > data to go to database.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Mixin to overwrite input field value?

Posted by Geoff Callender <ge...@gmail.com>.
Have you looked into using a translator instead of a mixin?

	http://jumpstart.doublenegative.com.au/jumpstart/examples/input/contributingtranslators
	Example (4) in http://jumpstart.doublenegative.com.au/jumpstart/examples/input/augmentingtranslators

Geoff

On 04/04/2013, at 9:40 PM, Dmitriy Vsekhvalnov wrote:

> Hi everyone,
> 
>  is it possible to have mixin which will intercept form submission (on T5
> side, not in browser) and overwrite input field value coming from client,
> before the value bound to input's property?
> 
> I'm using maskedit mixing for inputs, but for some values i want unmasked
> data to go to database.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org