You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by th...@webmd.net on 2002/02/15 23:49:32 UTC

PROBLEM, was Re: Can this be done at all using Form objects within struts framework

Ted (or anyone else):

I am having a problem (I'm a newbie) with calling an Action.do to "preload"
form data.

The problem I am having is that I want to have "validation=true" so that my
form will perform validation...

What's happening is I have a menu (from a jsp file) with the following:

<html:link page="/BillingAction.do?Mode=Add">

I have a BillingForm with a "validate()" method that I wish to use....

Apparently, struts always calls the forms validation() prior to my Action
perform().    Since the form has not yet come up, my required fields
validation is returning validation errors....

Is there a way to have an Action be a part of a link and NOT have the
corresponding form's validation called until you hit the "submit" button on
the form?    That's the way I thought it was supposed to behave but it is
not the case...

Is there a way around this?    I need to have "validation=true" in my
struts.config file but the framework will call "validation()" even before
the form is brought up  when I select the link tag :-(

thanks for any help,
Theron




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: PROBLEM, was Re: Can this be done at all using Form objects within strutsframework

Posted by Ted Husted <hu...@apache.org>.
Typically, there will be seperation ActionMappings for presenting the
form and storing the form. They may both use the same Action class, but
different ActionMappings. One has validate=false, the other has
validate=true. 

Another way to go would be to make mode a property on your form. Then in
your validate method, you can skip the validation if
getMode().equals("Add"). 

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Java Web Development with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/



theron.kousek@webmd.net wrote:
> 
> Ted (or anyone else):
> 
> I am having a problem (I'm a newbie) with calling an Action.do to "preload"
> form data.
> 
> The problem I am having is that I want to have "validation=true" so that my
> form will perform validation...
> 
> What's happening is I have a menu (from a jsp file) with the following:
> 
> <html:link page="/BillingAction.do?Mode=Add">
> 
> I have a BillingForm with a "validate()" method that I wish to use....
> 
> Apparently, struts always calls the forms validation() prior to my Action
> perform().    Since the form has not yet come up, my required fields
> validation is returning validation errors....
> 
> Is there a way to have an Action be a part of a link and NOT have the
> corresponding form's validation called until you hit the "submit" button on
> the form?    That's the way I thought it was supposed to behave but it is
> not the case...
> 
> Is there a way around this?    I need to have "validation=true" in my
> struts.config file but the framework will call "validation()" even before
> the form is brought up  when I select the link tag :-(
> 
> thanks for any help,
> Theron
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>