You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Igor Vlasov <vi...@mail.ru> on 2007/10/17 15:58:58 UTC
Disable validation when "delete" button is pressed
Hello.
I have
<s:form action="customer" method='post' theme="xhtml" >
<s:textfield name="customer.cus_email" size="20" label="E-mail" />
<s:submit value="OK." name="VIEW" theme="simple"> </s:submit>
<s:submit value="Delete" name="DEL" theme="simple"></s:submit>
</s:form>
and
CustomerCRUD-validation:
<validators>
<field name="customer.cus_email">
<field-validator type="email">
<message>Error E-mail</message>
</field-validator>
</field>
</validators>
How to DISABLE server side validation when i click on "DELETE" button and
have empty email field value ?
--
View this message in context: http://www.nabble.com/Disable-validation-when-%22delete%22-button-is-pressed-tf4640820.html#a13254463
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Disable validation when "delete" button is pressed
Posted by Igor Vlasov <vi...@mail.ru>.
The most elegant method is to give a SPECIAL name to "delete" button.
It must looks like:
<s:submit name="method:delete" value="Delete" />
and
<s:submit value="Execute" />
I found it in
http://www.nabble.com/struts2-validation-for-only-one-method-in-action-tf3267302.html
this post by Ian Roughley
an Roughley wrote:
>
> you can always use <s:submit name="method:delete" value="Delete" /> and
> <s:submit value="Execute" /> - then you don't need the logic to
> determine which button was clicked in the execute() method, and you can
> use the validation config below.
>
Original Post
Igor Vlasov wrote:
>
> Hello.
>
> I have
> <s:form action="customer" method='post' theme="xhtml" >
> <s:textfield name="customer.cus_email" size="20" label="E-mail" />
> <s:submit value="OK." name="VIEW" theme="simple"> </s:submit>
> <s:submit value="Delete" name="DEL" theme="simple"></s:submit>
> </s:form>
> and
>
> CustomerCRUD-validation:
> <validators>
> <field name="customer.cus_email">
> <field-validator type="email">
> <message>Error E-mail</message>
> </field-validator>
> </field>
> </validators>
>
>
>
> How to DISABLE server side validation when i click on "DELETE" button and
> have empty email field value ?
>
--
View this message in context: http://www.nabble.com/Disable-validation-when-%22delete%22-button-is-pressed-tf4640820.html#a13269390
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Disable validation when "delete" button is pressed
Posted by Gabriel Belingueres <be...@gmail.com>.
I've solved this by changing the action in the form:
<s:submit value="Delete" onclick="this.form.action= 'delete.action';" />
but you must rename your CustomerCRUD-validation.xml file to
CustomerCRUD-<ActionThatNeedsValidation>-validation.xml file.
Just don't define any validation file for the delete action.
2007/10/17, Igor Vlasov <vi...@mail.ru>:
>
> Hello.
>
> I have
> <s:form action="customer" method='post' theme="xhtml" >
> <s:textfield name="customer.cus_email" size="20" label="E-mail" />
> <s:submit value="OK." name="VIEW" theme="simple"> </s:submit>
> <s:submit value="Delete" name="DEL" theme="simple"></s:submit>
> </s:form>
> and
>
> CustomerCRUD-validation:
> <validators>
> <field name="customer.cus_email">
> <field-validator type="email">
> <message>Error E-mail</message>
> </field-validator>
> </field>
> </validators>
>
>
>
> How to DISABLE server side validation when i click on "DELETE" button and
> have empty email field value ?
> --
> View this message in context: http://www.nabble.com/Disable-validation-when-%22delete%22-button-is-pressed-tf4640820.html#a13254463
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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: Disable validation when "delete" button is pressed
Posted by Dave Newton <ne...@yahoo.com>.
One way is to submit to a different method for
deleting and configure the validation interceptor to
disable validation for that method for that action.
--- Igor Vlasov <vi...@mail.ru> wrote:
>
> Hello.
>
> I have
> <s:form action="customer" method='post'
> theme="xhtml" >
> <s:textfield name="customer.cus_email" size="20"
> label="E-mail" />
> <s:submit value="OK." name="VIEW"
> theme="simple"> </s:submit>
> <s:submit value="Delete" name="DEL"
> theme="simple"></s:submit>
> </s:form>
> and
>
> CustomerCRUD-validation:
> <validators>
> <field name="customer.cus_email">
> <field-validator type="email">
> <message>Error E-mail</message>
> </field-validator>
> </field>
> </validators>
>
>
>
> How to DISABLE server side validation when i click
> on "DELETE" button and
> have empty email field value ?
> --
> View this message in context:
>
http://www.nabble.com/Disable-validation-when-%22delete%22-button-is-pressed-tf4640820.html#a13254463
> Sent from the Struts - User mailing list archive at
> Nabble.com.
>
>
>
---------------------------------------------------------------------
> 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: Disable validation when "delete" button is pressed
Posted by "Jiang, Jane (NIH/NCI) [C]" <ji...@mail.nih.gov>.
You can use the @SkipValidation annotation in front of your delete
method.
-----Original Message-----
From: Igor Vlasov [mailto:vigor78@mail.ru]
Sent: Wednesday, October 17, 2007 9:59 AM
To: user@struts.apache.org
Subject: Disable validation when "delete" button is pressed
Hello.
I have
<s:form action="customer" method='post' theme="xhtml" >
<s:textfield name="customer.cus_email" size="20" label="E-mail" />
<s:submit value="OK." name="VIEW" theme="simple"> </s:submit>
<s:submit value="Delete" name="DEL" theme="simple"></s:submit>
</s:form>
and
CustomerCRUD-validation:
<validators>
<field name="customer.cus_email">
<field-validator type="email">
<message>Error E-mail</message>
</field-validator>
</field>
</validators>
How to DISABLE server side validation when i click on "DELETE" button
and
have empty email field value ?
--
View this message in context:
http://www.nabble.com/Disable-validation-when-%22delete%22-button-is-pre
ssed-tf4640820.html#a13254463
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
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