RE: 2 submit buttons with different action

2002-12-24 Thread VEDRE, RANAPRATAP REDDY
you can configure your action mapping with validation="false" and do the
validation in ur action class by calling the validation
method of your form(DynaValidatorForm).

struts does not call the validation method, as validation="false"
you can check in ur action class which button was pressed and call the
validate method only when submit is pressed.
you still dont have to write ur validate method as long as u have the form
in the validation.xml.

to check which button was pressed you can use the following in ur jsp


Submit


Back


and in ur action class 

  String buttonPressed = form.getAction();
  if(buttonPressed.equals("Submit"))
form.validate(request.errors);

  if(!errors.empty) 
   {
return mapping.getInputForward();
   }

  
 note that action should be a property in ur form. as u are using
dynavalidator form it should be present in ur form declaration in ur
struts-config.xml

-rana



-Original Message-
From: Arnaud HERITIER [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 24, 2002 11:14 AM
To: 'Struts Users Mailing List'
Subject: RE: 2 submit buttons with different action


In this page :
http://jakarta.apache.org/struts/userGuide/dev_validator.html

the doc says :

The most fundamental change is the ability to conditionally require
validator fields based on the value of other fields. It allows you to define
logic like "only validate this field if field X is non- null and field Y
equals "male".

I think it is possible to do what you want with the validator but don't know
how.


> -Message d'origine-
> De : Arnaud HERITIER [mailto:[EMAIL PROTECTED]]
> Envoye : mardi 24 decembre 2002 17:07
> A : 'Struts Users Mailing List'
> Objet : RE: 2 submit buttons with different action
>
>
> Sorry but I don't use yet the DynaValidationForm, so I don't
> know how to
> configure it :-(
>
> I don't know how is defined a validation.xml file but it is
> not possible to
> define dependencies between several fields ??
>
> If this field equals "bidule" then this other field should be
> equal to truc
> ???
>
> If it doesn't exist, it could be a good enhancement to
> propose I think.
>
> Arnaud
>
> > -Message d'origine-----
> > De : Ashish Kulkarni [mailto:[EMAIL PROTECTED]]
> > Envoye : mardi 24 decembre 2002 16:53
> > A : Struts Users Mailing List; [EMAIL PROTECTED]
> > Objet : RE: 2 submit buttons with different action
> >
> >
> > Hi,
> > I m using DynaVaidationForm so struts automatically
> > checks for the validation depending upon the
> > defination in validation.xml
> > is there a way out by using DynaValidationForm
> >
> > Ashish
> > --- Arnaud HERITIER <[EMAIL PROTECTED]> wrote:
> > > you can define a property in your form bean with a
> > > different value if you
> > > use one button or the other.
> > >
> > > In your validation method you test this property to
> > > verify if you check the
> > > others fields or not.
> > >
> > > Arnaud
> > >
> > > > -Message d'origine-
> > > > De : Ashish Kulkarni
> > > [mailto:[EMAIL PROTECTED]]
> > > > Envoye : mardi 24 decembre 2002 16:29
> > > > A : Struts Users Mailing List
> > > > Objet : 2 submit buttons with different action
> > > >
> > > >
> > > > Hi,
> > > >
> > > > I have 2 buttons on one jsp, one is submit button
> > > and
> > > > the other is back. I want to use only one action
> > > form
> > > > to handle both the events, I am using
> > > > DynaValidatorForm.
> > > > So the problem i amfacing is, the fields get
> > > validated
> > > > even if i press the back button,
> > > > Is there a way to make sure that the validation
> > > occurs
> > > > only when i press submit button
> > > >
> > > >
> > > >
> > > > =
> > > > A$HI$H
> > > >
> > > > __
> > > > Do you Yahoo!?
> > > > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> > > now.
> > > > http://mailplus.yahoo.com
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > >
> > > <mailto:[EMAIL PROTECTED]>
> > > > For additional commands, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > >
> >
> >
> > =
> > A$HI$H
> >
> > __
> > Do you Yahoo!?
> > Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> > http://mailplus.yahoo.com
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: 2 submit buttons with different action

2002-12-24 Thread Arnaud HERITIER
In this page :
http://jakarta.apache.org/struts/userGuide/dev_validator.html

the doc says :

The most fundamental change is the ability to conditionally require
validator fields based on the value of other fields. It allows you to define
logic like "only validate this field if field X is non- null and field Y
equals "male".

I think it is possible to do what you want with the validator but don't know
how.


> -Message d'origine-
> De : Arnaud HERITIER [mailto:[EMAIL PROTECTED]]
> Envoye : mardi 24 decembre 2002 17:07
> A : 'Struts Users Mailing List'
> Objet : RE: 2 submit buttons with different action
>
>
> Sorry but I don't use yet the DynaValidationForm, so I don't
> know how to
> configure it :-(
>
> I don't know how is defined a validation.xml file but it is
> not possible to
> define dependencies between several fields ??
>
> If this field equals "bidule" then this other field should be
> equal to truc
> ???
>
> If it doesn't exist, it could be a good enhancement to
> propose I think.
>
> Arnaud
>
> > -Message d'origine-
> > De : Ashish Kulkarni [mailto:[EMAIL PROTECTED]]
> > Envoye : mardi 24 decembre 2002 16:53
> > A : Struts Users Mailing List; [EMAIL PROTECTED]
> > Objet : RE: 2 submit buttons with different action
> >
> >
> > Hi,
> > I m using DynaVaidationForm so struts automatically
> > checks for the validation depending upon the
> > defination in validation.xml
> > is there a way out by using DynaValidationForm
> >
> > Ashish
> > --- Arnaud HERITIER <[EMAIL PROTECTED]> wrote:
> > > you can define a property in your form bean with a
> > > different value if you
> > > use one button or the other.
> > >
> > > In your validation method you test this property to
> > > verify if you check the
> > > others fields or not.
> > >
> > > Arnaud
> > >
> > > > -Message d'origine-
> > > > De : Ashish Kulkarni
> > > [mailto:[EMAIL PROTECTED]]
> > > > Envoye : mardi 24 decembre 2002 16:29
> > > > A : Struts Users Mailing List
> > > > Objet : 2 submit buttons with different action
> > > >
> > > >
> > > > Hi,
> > > >
> > > > I have 2 buttons on one jsp, one is submit button
> > > and
> > > > the other is back. I want to use only one action
> > > form
> > > > to handle both the events, I am using
> > > > DynaValidatorForm.
> > > > So the problem i amfacing is, the fields get
> > > validated
> > > > even if i press the back button,
> > > > Is there a way to make sure that the validation
> > > occurs
> > > > only when i press submit button
> > > >
> > > >
> > > >
> > > > =
> > > > A$HI$H
> > > >
> > > > __
> > > > Do you Yahoo!?
> > > > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> > > now.
> > > > http://mailplus.yahoo.com
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > >
> > > <mailto:[EMAIL PROTECTED]>
> > > > For additional commands, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > >
> >
> >
> > =
> > A$HI$H
> >
> > __
> > Do you Yahoo!?
> > Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> > http://mailplus.yahoo.com
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: 2 submit buttons with different action

2002-12-24 Thread Brian Lee
Have two submit buttons with different names and values.
Have a property for each in your form.
In your validate method check the value of each. Only the button that was 
clicked will have a nonnull value.

Example:
html:



form class:
...
private String submit;
private String back;
...

validate method:
if ("foo".equals(getSubmit())){
//do validation
}else{//getBack() should return null or empty string
//skip validation
}

I hope this helps.

BAL
> > -Message d'origine-
> > De : Ashish Kulkarni
> [mailto:[EMAIL PROTECTED]]
> > Envoye : mardi 24 decembre 2002 16:29
> > A : Struts Users Mailing List
> > Objet : 2 submit buttons with different action
> >
> >
> > Hi,
> >
> > I have 2 buttons on one jsp, one is submit button
> and
> > the other is back. I want to use only one action
> form
> > to handle both the events, I am using
> > DynaValidatorForm.
> > So the problem i amfacing is, the fields get
> validated
> > even if i press the back button,
> > Is there a way to make sure that the validation
> occurs
> > only when i press submit button
> >
> >
> >
> > =
> > A$HI$H



_
The new MSN 8: smart spam protection and 3 months FREE*.  
http://join.msn.com/?page=features/junkmail&xAPID=42&PS=47575&PI=7324&DI=7474&SU= 
http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_smartspamprotection_3mf


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 



RE: 2 submit buttons with different action

2002-12-24 Thread James Turner
Look at the "requiredif" validation in the current nightly builds.

James

> -Original Message-
> From: Arnaud HERITIER [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, December 24, 2002 11:07 AM
> To: 'Struts Users Mailing List'
> Subject: RE: 2 submit buttons with different action
> 
> 
> Sorry but I don't use yet the DynaValidationForm, so I don't 
> know how to configure it :-(
> 
> I don't know how is defined a validation.xml file but it is 
> not possible to define dependencies between several fields ??
> 
> If this field equals "bidule" then this other field should be 
> equal to truc ???
> 
> If it doesn't exist, it could be a good enhancement to 
> propose I think.
> 
> Arnaud
> 
> > -Message d'origine-
> > De : Ashish Kulkarni [mailto:[EMAIL PROTECTED]]
> > Envoye : mardi 24 decembre 2002 16:53
> > A : Struts Users Mailing List; [EMAIL PROTECTED]
> > Objet : RE: 2 submit buttons with different action
> >
> >
> > Hi,
> > I m using DynaVaidationForm so struts automatically
> > checks for the validation depending upon the
> > defination in validation.xml
> > is there a way out by using DynaValidationForm
> >
> > Ashish
> > --- Arnaud HERITIER <[EMAIL PROTECTED]> wrote:
> > > you can define a property in your form bean with a 
> different value 
> > > if you use one button or the other.
> > >
> > > In your validation method you test this property to
> > > verify if you check the
> > > others fields or not.
> > >
> > > Arnaud
> > >
> > > > -Message d'origine-
> > > > De : Ashish Kulkarni
> > > [mailto:[EMAIL PROTECTED]]
> > > > Envoye : mardi 24 decembre 2002 16:29
> > > > A : Struts Users Mailing List
> > > > Objet : 2 submit buttons with different action
> > > >
> > > >
> > > > Hi,
> > > >
> > > > I have 2 buttons on one jsp, one is submit button
> > > and
> > > > the other is back. I want to use only one action
> > > form
> > > > to handle both the events, I am using
> > > > DynaValidatorForm.
> > > > So the problem i amfacing is, the fields get
> > > validated
> > > > even if i press the back button,
> > > > Is there a way to make sure that the validation
> > > occurs
> > > > only when i press submit button
> > > >
> > > >
> > > >
> > > > =
> > > > A$HI$H
> > > >
> > > > __
> > > > Do you Yahoo!?
> > > > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> > > now.
> > > > http://mailplus.yahoo.com
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > >
> > > <mailto:[EMAIL PROTECTED]>
> > > > For additional commands, e-mail: 
> > > > <mailto:[EMAIL PROTECTED]>
> > > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail: 
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail: 
> > > <mailto:[EMAIL PROTECTED]>
> > >
> >
> >
> > =
> > A$HI$H
> >
> > __
> > Do you Yahoo!?
> > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. 
> > http://mailplus.yahoo.com
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 
> 
> --
> To 
> unsubscribe, e-mail:   
> <mailto:struts-user-> [EMAIL PROTECTED]>
> For 
> additional commands, 
> e-mail: <mailto:[EMAIL PROTECTED]>
> 



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: 2 submit buttons with different action

2002-12-24 Thread Arnaud HERITIER
Sorry but I don't use yet the DynaValidationForm, so I don't know how to
configure it :-(

I don't know how is defined a validation.xml file but it is not possible to
define dependencies between several fields ??

If this field equals "bidule" then this other field should be equal to truc
???

If it doesn't exist, it could be a good enhancement to propose I think.

Arnaud

> -Message d'origine-
> De : Ashish Kulkarni [mailto:[EMAIL PROTECTED]]
> Envoye : mardi 24 decembre 2002 16:53
> A : Struts Users Mailing List; [EMAIL PROTECTED]
> Objet : RE: 2 submit buttons with different action
>
>
> Hi,
> I m using DynaVaidationForm so struts automatically
> checks for the validation depending upon the
> defination in validation.xml
> is there a way out by using DynaValidationForm
>
> Ashish
> --- Arnaud HERITIER <[EMAIL PROTECTED]> wrote:
> > you can define a property in your form bean with a
> > different value if you
> > use one button or the other.
> >
> > In your validation method you test this property to
> > verify if you check the
> > others fields or not.
> >
> > Arnaud
> >
> > > -Message d'origine-
> > > De : Ashish Kulkarni
> > [mailto:[EMAIL PROTECTED]]
> > > Envoye : mardi 24 decembre 2002 16:29
> > > A : Struts Users Mailing List
> > > Objet : 2 submit buttons with different action
> > >
> > >
> > > Hi,
> > >
> > > I have 2 buttons on one jsp, one is submit button
> > and
> > > the other is back. I want to use only one action
> > form
> > > to handle both the events, I am using
> > > DynaValidatorForm.
> > > So the problem i amfacing is, the fields get
> > validated
> > > even if i press the back button,
> > > Is there a way to make sure that the validation
> > occurs
> > > only when i press submit button
> > >
> > >
> > >
> > > =
> > > A$HI$H
> > >
> > > __
> > > Do you Yahoo!?
> > > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> > now.
> > > http://mailplus.yahoo.com
> > >
> > > --
> > > To unsubscribe, e-mail:
> > >
> > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
>
>
> =
> A$HI$H
>
> __
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: 2 submit buttons with different action

2002-12-24 Thread Ashish Kulkarni
Hi,
I m using DynaVaidationForm so struts automatically
checks for the validation depending upon the
defination in validation.xml
is there a way out by using DynaValidationForm

Ashish
--- Arnaud HERITIER <[EMAIL PROTECTED]> wrote:
> you can define a property in your form bean with a
> different value if you
> use one button or the other.
> 
> In your validation method you test this property to
> verify if you check the
> others fields or not.
> 
> Arnaud
> 
> > -Message d'origine-
> > De : Ashish Kulkarni
> [mailto:[EMAIL PROTECTED]]
> > Envoye : mardi 24 decembre 2002 16:29
> > A : Struts Users Mailing List
> > Objet : 2 submit buttons with different action
> >
> >
> > Hi,
> >
> > I have 2 buttons on one jsp, one is submit button
> and
> > the other is back. I want to use only one action
> form
> > to handle both the events, I am using
> > DynaValidatorForm.
> > So the problem i amfacing is, the fields get
> validated
> > even if i press the back button,
> > Is there a way to make sure that the validation
> occurs
> > only when i press submit button
> >
> >
> >
> > =
> > A$HI$H
> >
> > __
> > Do you Yahoo!?
> > Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> > http://mailplus.yahoo.com
> >
> > --
> > To unsubscribe, e-mail:
> >
> 
> > For additional commands, e-mail:
> > 
> >
> 
> 
> --
> To unsubscribe, e-mail:  
> 
> For additional commands, e-mail:
> 
> 


=
A$HI$H

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: 2 submit buttons with different action

2002-12-24 Thread Arnaud HERITIER
you can define a property in your form bean with a different value if you
use one button or the other.

In your validation method you test this property to verify if you check the
others fields or not.

Arnaud

> -Message d'origine-
> De : Ashish Kulkarni [mailto:[EMAIL PROTECTED]]
> Envoye : mardi 24 decembre 2002 16:29
> A : Struts Users Mailing List
> Objet : 2 submit buttons with different action
>
>
> Hi,
>
> I have 2 buttons on one jsp, one is submit button and
> the other is back. I want to use only one action form
> to handle both the events, I am using
> DynaValidatorForm.
> So the problem i amfacing is, the fields get validated
> even if i press the back button,
> Is there a way to make sure that the validation occurs
> only when i press submit button
>
>
>
> =
> A$HI$H
>
> __
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
> --
> To unsubscribe, e-mail:
> 
> For additional commands, e-mail:
> 
>


--
To unsubscribe, e-mail:   
For additional commands, e-mail: