You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by fea jabi <zy...@hotmail.com> on 2007/02/08 16:01:01 UTC

validation help


Have 2 radio buttons of ID and Name and an input field to enter criteria.


When the ID is selected the criteria the user entered should be numeric.
Should display the user with the appropriate message that only int
value is allowed.

When the Name is selected the criteria the user entered
should be alphanumeric. Should display appropriate message that only
alphanumeric values are allowed.

Tried the below it works great for the second option. Not sure how can I 
join
the two conditions.

    <formset>
        <form name="search">
            <field property="criteria" depends="mask">
                <msg name="mask" key="error.alphanumeric"/>
                <arg0 name="mask" key="lbl.criteria" />
                <var>
                	<var-name>mask</var-name>
                	<var-value>${alpha_numeric}</var-value>
                </var>
            </field>
        </form>
    </formset>

You help is appreciated. Thanks.

_________________________________________________________________
Laugh, share and connect with Windows Live Messenger 
http://clk.atdmt.com/MSN/go/msnnkwme0020000001msn/direct/01/?href=http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=hmtagline


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: validation help

Posted by Niall Pemberton <ni...@gmail.com>.
I don't think you can do this without either a custom validator or as
Jim suggests, implementing it in the validate method of your form.

Niall

On 2/9/07, Jim Reynolds <ji...@gmail.com> wrote:
> It appears you are probably using the ValidatorForm or
> ValidatorActionForm in 1.x?
> Just a thought ... could you just implement the validate method in the
> Action form and handle it with logic? I did some looking, and see that
> you can validate two fields against each other, but I couldn't find
> anywhere to do if/else logic in the validation.xml file.
>
> Possibly the Struts cookbook may have an example, but I don't have
> that book here. Maybe someone else on the list may have that.
>
>
>
> On 2/9/07, fea jabi <zy...@hotmail.com> wrote:
> > can someone help me with this please. thanks.
> >
> >
> > >From: "fea jabi" <zy...@hotmail.com>
> > >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> > >To: user@struts.apache.org
> > >Subject: validation help
> > >Date: Thu, 08 Feb 2007 10:01:01 -0500
> > >
> > >
> > >
> > >Have 2 radio buttons of ID and Name and an input field to enter criteria.
> > >
> > >
> > >When the ID is selected the criteria the user entered should be numeric.
> > >Should display the user with the appropriate message that only int
> > >value is allowed.
> > >
> > >When the Name is selected the criteria the user entered
> > >should be alphanumeric. Should display appropriate message that only
> > >alphanumeric values are allowed.
> > >
> > >Tried the below it works great for the second option. Not sure how can I
> > >join
> > >the two conditions.
> > >
> > >    <formset>
> > >        <form name="search">
> > >            <field property="criteria" depends="mask">
> > >                <msg name="mask" key="error.alphanumeric"/>
> > >                <arg0 name="mask" key="lbl.criteria" />
> > >                <var>
> > >                       <var-name>mask</var-name>
> > >                       <var-value>${alpha_numeric}</var-value>
> > >                </var>
> > >            </field>
> > >        </form>
> > >    </formset>
> > >
> > >You help is appreciated. Thanks.
> > >
> > >_________________________________________________________________
> > >Laugh, share and connect with Windows Live Messenger
> > >http://clk.atdmt.com/MSN/go/msnnkwme0020000001msn/direct/01/?href=http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=hmtagline
> > >
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > >For additional commands, e-mail: user-help@struts.apache.org
> > >
> >
> > _________________________________________________________________
> > Turn searches into helpful donations. Make your search count.
> > http://click4thecause.live.com/search/charity/default.aspx?source=hmemtagline_donation&FORM=WLMTAG
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: validation help

Posted by Jim Reynolds <ji...@gmail.com>.
It appears you are probably using the ValidatorForm or
ValidatorActionForm in 1.x?
Just a thought ... could you just implement the validate method in the
Action form and handle it with logic? I did some looking, and see that
you can validate two fields against each other, but I couldn't find
anywhere to do if/else logic in the validation.xml file.

Possibly the Struts cookbook may have an example, but I don't have
that book here. Maybe someone else on the list may have that.



On 2/9/07, fea jabi <zy...@hotmail.com> wrote:
> can someone help me with this please. thanks.
>
>
> >From: "fea jabi" <zy...@hotmail.com>
> >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> >To: user@struts.apache.org
> >Subject: validation help
> >Date: Thu, 08 Feb 2007 10:01:01 -0500
> >
> >
> >
> >Have 2 radio buttons of ID and Name and an input field to enter criteria.
> >
> >
> >When the ID is selected the criteria the user entered should be numeric.
> >Should display the user with the appropriate message that only int
> >value is allowed.
> >
> >When the Name is selected the criteria the user entered
> >should be alphanumeric. Should display appropriate message that only
> >alphanumeric values are allowed.
> >
> >Tried the below it works great for the second option. Not sure how can I
> >join
> >the two conditions.
> >
> >    <formset>
> >        <form name="search">
> >            <field property="criteria" depends="mask">
> >                <msg name="mask" key="error.alphanumeric"/>
> >                <arg0 name="mask" key="lbl.criteria" />
> >                <var>
> >                       <var-name>mask</var-name>
> >                       <var-value>${alpha_numeric}</var-value>
> >                </var>
> >            </field>
> >        </form>
> >    </formset>
> >
> >You help is appreciated. Thanks.
> >
> >_________________________________________________________________
> >Laugh, share and connect with Windows Live Messenger
> >http://clk.atdmt.com/MSN/go/msnnkwme0020000001msn/direct/01/?href=http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=hmtagline
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >For additional commands, e-mail: user-help@struts.apache.org
> >
>
> _________________________________________________________________
> Turn searches into helpful donations. Make your search count.
> http://click4thecause.live.com/search/charity/default.aspx?source=hmemtagline_donation&FORM=WLMTAG
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: validation help

Posted by fea jabi <zy...@hotmail.com>.
can someone help me with this please. thanks.


>From: "fea jabi" <zy...@hotmail.com>
>Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>To: user@struts.apache.org
>Subject: validation help
>Date: Thu, 08 Feb 2007 10:01:01 -0500
>
>
>
>Have 2 radio buttons of ID and Name and an input field to enter criteria.
>
>
>When the ID is selected the criteria the user entered should be numeric.
>Should display the user with the appropriate message that only int
>value is allowed.
>
>When the Name is selected the criteria the user entered
>should be alphanumeric. Should display appropriate message that only
>alphanumeric values are allowed.
>
>Tried the below it works great for the second option. Not sure how can I 
>join
>the two conditions.
>
>    <formset>
>        <form name="search">
>            <field property="criteria" depends="mask">
>                <msg name="mask" key="error.alphanumeric"/>
>                <arg0 name="mask" key="lbl.criteria" />
>                <var>
>                	<var-name>mask</var-name>
>                	<var-value>${alpha_numeric}</var-value>
>                </var>
>            </field>
>        </form>
>    </formset>
>
>You help is appreciated. Thanks.
>
>_________________________________________________________________
>Laugh, share and connect with Windows Live Messenger 
>http://clk.atdmt.com/MSN/go/msnnkwme0020000001msn/direct/01/?href=http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=hmtagline
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>

_________________________________________________________________
Turn searches into helpful donations. Make your search count. 
http://click4thecause.live.com/search/charity/default.aspx?source=hmemtagline_donation&FORM=WLMTAG


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org