You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by su...@tcs.com on 2004/02/24 17:21:13 UTC

Validation doubt?

Hi,
        I do not want to validate my form when the user clicks the Cancel 
button.
For your information im not using javascript validation [i.e my doesnt've 
<html:javascript formname="someform">]
how to do this?

Subramaniam Olaganthan
Tata Consultancy Services
Mailto: subramaniam.o@tcs.com
Website: http://www.tcs.com

Re: Validation doubt?

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
The question is when the user 'cancels' do you want to do anything before you forward to the home page. 

If you don't need to do any processing before forwarding to the home page then just have a <html:link> to the home page.

If you do ...

The <html:cancel> tag generates an <input type="submit" name="org.apache.struts.taglib.html.CANCEL" value="..." onclick="bCancel=true;"/>. The javascript validations are not performed if bCancel is true and the RequestProcessor skips validations if the request contains  'org.apache.struts.taglib.html.CANCEL'

As you are not using the  <html:cancel> tag, you need to do what it does so that validations are not done or put your own check in the forms validate() method so that if the user is "cancelling" then don't do the validation. I guess something along the lines of...

   <html:image property="org.apache.struts.taglib.html.CANCEL" onclick="bCancel=true;"  .....>

Although I haven't tried it.


Niall

  ----- Original Message ----- 
  From: subramaniam.o@tcs.com 
  To: Struts Users Mailing List 
  Sent: Tuesday, February 24, 2004 8:45 PM
  Subject: RE: Validation doubt?



  Hi, 
  I tried that one, but i couldnt bypass the validation...... 
  i've an Update page, some of the attributes are mandatory. 
  onlick of the cancel btn im forwarding it to the home page, 
  onclick of the cancel btn it validates the form and gives error. 
  how do i bypass that one. 

  Note:- 
  Im using Images and not <html:cancel> 

  Subramaniam Olaganthan
  Tata Consultancy Services
  Mailto: subramaniam.o@tcs.com
  Website: http://www.tcs.com 


        "Angharad Stapleton" <a_...@chiconi.com> 
        02/24/2004 10:17 PM 
              Please respond to
              "Struts Users Mailing List" <st...@jakarta.apache.org> 


       To "Struts Users Mailing List" <st...@jakarta.apache.org>  
              cc  
              Subject RE: Validation doubt? 

              

       



  Either just use javascript to send to home page, or add a path in
  struts-config to go to home page if cancel button was selected.
   -----Original Message-----
   From: subramaniam.o@tcs.com [mailto:subramaniam.o@tcs.com]
   Sent: 24 February 2004 16:40
   To: Struts Users Mailing List
   Subject: RE: Validation doubt?



   Hi,
   Thank you for the information.
   on click of the cancel btn i want to show the home page. how do i do that?

   Subramaniam Olaganthan
   Tata Consultancy Services
   Plot No. 21
   Industrial Estate,, Ambattur
   Chennai - 600 058,Tamil Nadu
   India
   Mailto: subramaniam.o@tcs.com
   Website: http://www.tcs.com


         Vinay Kumar Munikuntla <vi...@shaws.com>
         02/24/2004 10:00 PM
               Please respond to
               "Struts Users Mailing List" <st...@jakarta.apache.org>


        To 'Struts Users Mailing List' <st...@jakarta.apache.org>
               cc subramaniam.o@tcs.com
               Subject RE: Validation doubt?







   Don't submit the form when user clicks on cancel button..... This will
  avoid
   calling validate method off the form bean.
    -----Original Message-----
    From: subramaniam.o@tcs.com [mailto:subramaniam.o@tcs.com]
    Sent: Tuesday, February 24, 2004 11:21 AM
    To: struts-user@jakarta.apache.org
    Subject: Validation doubt?



    Hi,
            I do not want to validate my form when the user clicks the Cancel
   button.
    For your information im not using javascript validation [i.e my doesnt've
   <html:javascript formname="someform">]
    how to do this?

    Subramaniam Olaganthan
    Tata Consultancy Services
    Mailto: subramaniam.o@tcs.com
    Website: http://www.tcs.com



   -----------------------------------------
   This email, including any attachments, is for the designated recipient(s)
  only and may contain confidential, proprietary, and/or legally privileged
  information.  If you are not a designated recipient, or have received it in
  error, please notify the sender and destroy it and all attachments and
  copies immediately, without distributing, disclosing, or using it in any
  manner.
   ForwardSourceID:NT0000413E

  ForwardSourceID:NT00004176     



------------------------------------------------------------------------------


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

RE: Validation doubt?

Posted by su...@tcs.com.
Hi,
I tried that one, but i couldnt bypass the validation......
i've an Update page, some of the attributes are mandatory.
onlick of the cancel btn im forwarding it to the home page, 
onclick of the cancel btn it validates the form and gives error.
how do i bypass that one.

Note:-
Im using Images and not <html:cancel> 

Subramaniam Olaganthan
Tata Consultancy Services
Mailto: subramaniam.o@tcs.com
Website: http://www.tcs.com



"Angharad Stapleton" <a_...@chiconi.com> 
02/24/2004 10:17 PM

Please respond to
"Struts Users Mailing List" <st...@jakarta.apache.org>


To
"Struts Users Mailing List" <st...@jakarta.apache.org>
cc

Subject
RE: Validation doubt?






Either just use javascript to send to home page, or add a path in
struts-config to go to home page if cancel button was selected.
  -----Original Message-----
  From: subramaniam.o@tcs.com [mailto:subramaniam.o@tcs.com]
  Sent: 24 February 2004 16:40
  To: Struts Users Mailing List
  Subject: RE: Validation doubt?



  Hi,
  Thank you for the information.
  on click of the cancel btn i want to show the home page. how do i do 
that?

  Subramaniam Olaganthan
  Tata Consultancy Services
  Plot No. 21
  Industrial Estate,, Ambattur
  Chennai - 600 058,Tamil Nadu
  India
  Mailto: subramaniam.o@tcs.com
  Website: http://www.tcs.com


        Vinay Kumar Munikuntla <vi...@shaws.com>
        02/24/2004 10:00 PM
              Please respond to
              "Struts Users Mailing List" <st...@jakarta.apache.org>


       To 'Struts Users Mailing List' <st...@jakarta.apache.org>
              cc subramaniam.o@tcs.com
              Subject RE: Validation doubt?







  Don't submit the form when user clicks on cancel button..... This will
avoid
  calling validate method off the form bean.
   -----Original Message-----
   From: subramaniam.o@tcs.com [mailto:subramaniam.o@tcs.com]
   Sent: Tuesday, February 24, 2004 11:21 AM
   To: struts-user@jakarta.apache.org
   Subject: Validation doubt?



   Hi,
           I do not want to validate my form when the user clicks the 
Cancel
  button.
   For your information im not using javascript validation [i.e my 
doesnt've
  <html:javascript formname="someform">]
   how to do this?

   Subramaniam Olaganthan
   Tata Consultancy Services
   Mailto: subramaniam.o@tcs.com
   Website: http://www.tcs.com



  -----------------------------------------
  This email, including any attachments, is for the designated 
recipient(s)
only and may contain confidential, proprietary, and/or legally privileged
information.  If you are not a designated recipient, or have received it 
in
error, please notify the sender and destroy it and all attachments and
copies immediately, without distributing, disclosing, or using it in any
manner.
  ForwardSourceID:NT0000413E

ForwardSourceID:NT00004176 

RE: Validation doubt?

Posted by Angharad Stapleton <a_...@chiconi.com>.
Either just use javascript to send to home page, or add a path in
struts-config to go to home page if cancel button was selected.
  -----Original Message-----
  From: subramaniam.o@tcs.com [mailto:subramaniam.o@tcs.com]
  Sent: 24 February 2004 16:40
  To: Struts Users Mailing List
  Subject: RE: Validation doubt?



  Hi,
  Thank you for the information.
  on click of the cancel btn i want to show the home page. how do i do that?

  Subramaniam Olaganthan
  Tata Consultancy Services
  Plot No. 21
  Industrial Estate,, Ambattur
  Chennai - 600 058,Tamil Nadu
  India
  Mailto: subramaniam.o@tcs.com
  Website: http://www.tcs.com


        Vinay Kumar Munikuntla <vi...@shaws.com>
        02/24/2004 10:00 PM
              Please respond to
              "Struts Users Mailing List" <st...@jakarta.apache.org>


       To 'Struts Users Mailing List' <st...@jakarta.apache.org>
              cc subramaniam.o@tcs.com
              Subject RE: Validation doubt?







  Don't submit the form when user clicks on cancel button..... This will
avoid
  calling validate method off the form bean.
   -----Original Message-----
   From: subramaniam.o@tcs.com [mailto:subramaniam.o@tcs.com]
   Sent: Tuesday, February 24, 2004 11:21 AM
   To: struts-user@jakarta.apache.org
   Subject: Validation doubt?



   Hi,
           I do not want to validate my form when the user clicks the Cancel
  button.
   For your information im not using javascript validation [i.e my doesnt've
  <html:javascript formname="someform">]
   how to do this?

   Subramaniam Olaganthan
   Tata Consultancy Services
   Mailto: subramaniam.o@tcs.com
   Website: http://www.tcs.com



  -----------------------------------------
  This email, including any attachments, is for the designated recipient(s)
only and may contain confidential, proprietary, and/or legally privileged
information.  If you are not a designated recipient, or have received it in
error, please notify the sender and destroy it and all attachments and
copies immediately, without distributing, disclosing, or using it in any
manner.
  ForwardSourceID:NT0000413E

RE: Validation doubt?

Posted by Vinay Kumar Munikuntla <vi...@shaws.com>.
Use link

<html:link page="/homepage.do">
    ..... Cancel ......
</html:link>
  -----Original Message-----
  From: subramaniam.o@tcs.com [mailto:subramaniam.o@tcs.com]
  Sent: Tuesday, February 24, 2004 11:40 AM
  To: Struts Users Mailing List
  Subject: RE: Validation doubt?



  Hi,
  Thank you for the information.
  on click of the cancel btn i want to show the home page. how do i do that?

  Subramaniam Olaganthan
  Tata Consultancy Services
  Plot No. 21
  Industrial Estate,, Ambattur
  Chennai - 600 058,Tamil Nadu
  India
  Mailto: subramaniam.o@tcs.com
  Website: http://www.tcs.com


        Vinay Kumar Munikuntla <vi...@shaws.com>
        02/24/2004 10:00 PM
              Please respond to
              "Struts Users Mailing List" <st...@jakarta.apache.org>


       To 'Struts Users Mailing List' <st...@jakarta.apache.org>
              cc subramaniam.o@tcs.com
              Subject RE: Validation doubt?







  Don't submit the form when user clicks on cancel button..... This will
avoid
  calling validate method off the form bean.
   -----Original Message-----
   From: subramaniam.o@tcs.com [mailto:subramaniam.o@tcs.com]
   Sent: Tuesday, February 24, 2004 11:21 AM
   To: struts-user@jakarta.apache.org
   Subject: Validation doubt?



   Hi,
           I do not want to validate my form when the user clicks the Cancel
  button.
   For your information im not using javascript validation [i.e my doesnt've
  <html:javascript formname="someform">]
   how to do this?

   Subramaniam Olaganthan
   Tata Consultancy Services
   Mailto: subramaniam.o@tcs.com
   Website: http://www.tcs.com



  -----------------------------------------
  This email, including any attachments, is for the designated recipient(s)
only and may contain confidential, proprietary, and/or legally privileged
information.  If you are not a designated recipient, or have received it in
error, please notify the sender and destroy it and all attachments and
copies immediately, without distributing, disclosing, or using it in any
manner.
  ForwardSourceID:NT0000413E



-----------------------------------------
This email, including any attachments, is for the designated recipient(s) only and may contain confidential, proprietary, and/or legally privileged information.  If you are not a designated recipient, or have received it in error, please notify the sender and destroy it and all attachments and copies immediately, without distributing, disclosing, or using it in any manner.

RE: Validation doubt?

Posted by su...@tcs.com.
Hi,
Thank you for the information.
on click of the cancel btn i want to show the home page. how do i do that?

Subramaniam Olaganthan
Tata Consultancy Services
Plot No. 21
Industrial Estate,, Ambattur
Chennai - 600 058,Tamil Nadu
India
Mailto: subramaniam.o@tcs.com
Website: http://www.tcs.com



Vinay Kumar Munikuntla <vi...@shaws.com> 
02/24/2004 10:00 PM

Please respond to
"Struts Users Mailing List" <st...@jakarta.apache.org>


To
'Struts Users Mailing List' <st...@jakarta.apache.org>
cc
subramaniam.o@tcs.com
Subject
RE: Validation doubt?






Don't submit the form when user clicks on cancel button..... This will 
avoid
calling validate method off the form bean.
  -----Original Message-----
  From: subramaniam.o@tcs.com [mailto:subramaniam.o@tcs.com]
  Sent: Tuesday, February 24, 2004 11:21 AM
  To: struts-user@jakarta.apache.org
  Subject: Validation doubt?



  Hi,
          I do not want to validate my form when the user clicks the 
Cancel
button.
  For your information im not using javascript validation [i.e my 
doesnt've
<html:javascript formname="someform">]
  how to do this?

  Subramaniam Olaganthan
  Tata Consultancy Services
  Mailto: subramaniam.o@tcs.com
  Website: http://www.tcs.com



-----------------------------------------
This email, including any attachments, is for the designated recipient(s) 
only and may contain confidential, proprietary, and/or legally privileged 
information.  If you are not a designated recipient, or have received it 
in error, please notify the sender and destroy it and all attachments and 
copies immediately, without distributing, disclosing, or using it in any 
manner.
ForwardSourceID:NT0000413E 

RE: Validation doubt?

Posted by Vinay Kumar Munikuntla <vi...@shaws.com>.
Don't submit the form when user clicks on cancel button..... This will avoid
calling validate method off the form bean.
  -----Original Message-----
  From: subramaniam.o@tcs.com [mailto:subramaniam.o@tcs.com]
  Sent: Tuesday, February 24, 2004 11:21 AM
  To: struts-user@jakarta.apache.org
  Subject: Validation doubt?



  Hi,
          I do not want to validate my form when the user clicks the Cancel
button.
  For your information im not using javascript validation [i.e my doesnt've
<html:javascript formname="someform">]
  how to do this?

  Subramaniam Olaganthan
  Tata Consultancy Services
  Mailto: subramaniam.o@tcs.com
  Website: http://www.tcs.com



-----------------------------------------
This email, including any attachments, is for the designated recipient(s) only and may contain confidential, proprietary, and/or legally privileged information.  If you are not a designated recipient, or have received it in error, please notify the sender and destroy it and all attachments and copies immediately, without distributing, disclosing, or using it in any manner.

RE: Validation doubt?

Posted by su...@tcs.com.
Hi,
   Thanks for the information but, all my forms extends 
ValidatorActionForm and Im Using Validation.xml for
validating the form. how do i do that?
Please help me fix this one. Thanks in advance.

Subramaniam Olaganthan
Tata Consultancy Services
Mailto: subramaniam.o@tcs.com
Website: http://www.tcs.com



"Angharad Stapleton" <a_...@chiconi.com> 
02/24/2004 09:57 PM

Please respond to
"Struts Users Mailing List" <st...@jakarta.apache.org>


To
"Struts Users Mailing List" <st...@jakarta.apache.org>
cc

Subject
RE: Validation doubt?






Have the submit button has a form property. Then when validating only 
valid
if submit button was hit.

e.g. if ((this.getSubmitButton() != null) && (!(
this.getSubmitButton().equals("")))){
       ... validation code
       }
  -----Original Message-----
  From: subramaniam.o@tcs.com [mailto:subramaniam.o@tcs.com]
  Sent: 24 February 2004 16:21
  To: struts-user@jakarta.apache.org
  Subject: Validation doubt?



  Hi,
          I do not want to validate my form when the user clicks the 
Cancel
button.
  For your information im not using javascript validation [i.e my 
doesnt've
<html:javascript formname="someform">]
  how to do this?

  Subramaniam Olaganthan
  Tata Consultancy Services
  Mailto: subramaniam.o@tcs.com
  Website: http://www.tcs.com

ForwardSourceID:NT00004132 

RE: Validation doubt?

Posted by Angharad Stapleton <a_...@chiconi.com>.
Have the submit button has a form property. Then when validating only valid
if submit button was hit.

e.g. if ((this.getSubmitButton() != null) && (!(
this.getSubmitButton().equals("")))){
       ... validation code
       }
  -----Original Message-----
  From: subramaniam.o@tcs.com [mailto:subramaniam.o@tcs.com]
  Sent: 24 February 2004 16:21
  To: struts-user@jakarta.apache.org
  Subject: Validation doubt?



  Hi,
          I do not want to validate my form when the user clicks the Cancel
button.
  For your information im not using javascript validation [i.e my doesnt've
<html:javascript formname="someform">]
  how to do this?

  Subramaniam Olaganthan
  Tata Consultancy Services
  Mailto: subramaniam.o@tcs.com
  Website: http://www.tcs.com