Thanks. David. I am still confused by the automatic
validation. I couldn't turn it off.
--- "David G. Friedman" <[EMAIL PROTECTED]> wrote:

> Tong,
> 
> You can change the form's submit action using almost
> any form field type
> (except hidden) using the onClick or onChange
> methods.
> 
> If you have a submit button button, you can do this:
> <input type="submit" name="Save" value="save"
> onClick="this.form.action='/save.do';return true;"
> />
> 
> To save the button name into a hidden parameter such
> as a hidden field
> ActionName, you can do this:
> <input type="hidden" name="ActionName" />
> <input type="submit name="Save" value="save"
> onClick="this.form.ActionName.value='save';return
> true;" />
> <input type="submit name="Delete" value="delete"
> onClick="this.form.ActionName.value=delete';" />
> 
> Or even:
> 
> <input type="submit name="Save" value="save"
> onClick="this.form.ActionName.value=this.value;" />
> (I might be slightly off on the ActionName.value
> setting property).
> 
> If you choose to make the onClick invoke a function
> (for performing even
> more steps than that) and the input was a submit
> button, remember to NOT do
> a form.submit() within that JS function - it would
> cause a double submit
> when invoked from a submit button.  If it isn't a
> submit button but some
> other type of button, you can probably do a
> form.submit() if it doesn't do
> it automatically.
> 
> As for preventing automatic validation in an Action,
> Erik was spot on with
> validate="false" as an attribute and value in your
> <action .../> mapping.
> Just invoke the validate method with the appropriate
> arguments for the
> Action class you're extending.
> 
> And finally, on your topic of making one select
> change another select, the
> only way I know (and did this once, long ago) was to
> set a javascript
> function to be called by the first one's onClick or
> onChange method.  That
> function can be passed the this.form object, then
> get to the second pulldown
> by name or id, delete every select item, then add
> each new item.  Creative
> use of the iterate tag plus javascript can do it, or
> you could find good
> examples if you google - that's how I learned how to
> do it.
> 
> Regards,
> David
> 
> -----Original Message-----
> From: t t [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 10, 2004 6:41 PM
> To: Struts Users Mailing List
> Subject: Re: Help needed on question regarding
> html:select and
> html:options...cannot turn off validator
> 
> 
> How can I turn off validator? THanks.
> --- t t <[EMAIL PROTECTED]> wrote:
> 
> > Or I can set a parameter before executing the
> added
> > action.
> > --- t t <[EMAIL PROTECTED]> wrote:
> >
> > > Hi, Erik,
> > > I got an idea. I can insert another action
> before
> > > the actual action be executed. And  use
> javascript
> > > change a hidden property before executing the
> > added
> > > action, then  I can do what i want to do in the
> > > added action. What do you think? I will try it
> > > later.
> > > Thanks for your help!
> > > Tong
> > >
> > > Erik Weber <[EMAIL PROTECTED]> wrote:
> > > JavaScript can change the action URL on the fly.
> > For
> > > example:
> > >
> > >
> >
>
http://www.willmaster.com/possibilities/archives/wmp20030527001.shtml
> > >
> > > However, I'm not sure how compatible this type
> of
> > > thing will be with the
> > > Struts form tag. I've never tried it. I'm
> > surprised
> > > others aren't
> > > speaking up because the "multiple submit"
> problem
> > > comes up a lot. If you
> > > search the archives for "multiple submit
> buttons"
> > > you might find other
> > > ideas.
> > >
> > > Erik
> > >
> > >
> > > t t wrote:
> > >
> > > >Hi,Erik,
> > > >I think that helps. I have another question.
> > > Besides the "action" attribute in html:form, is
> > > anywhere else we can specify another "action"
> > > corresponding the submission of javascript?
> > > >Thanks.
> > > >Tong
> > > >
> > > >Erik Weber wrote:
> > > >There may be other ways or better ways, but one
> > > thing you could do is
> > > >vary the action URL. You could have the same
> > action
> > > class serving
> > > >slightly different action mappings, some with
> > > validation set to true and
> > > >some with validation set to false.
> > > >
> > > >I did what you are trying to do in a non-Struts
> > > Servlet app, and there I
> > > >just used a query string parameter to indicate
> > > which type of submit was
> > > >happening (but I didn't have to worry about
> > getting
> > > past the validator).
> > > >Remember that JavaScript can change the value
> of
> > a
> > > field (including a
> > > >hidden field) before it submits the form.
> > > >
> > > >Also, another technique for conditionally using
> > the
> > > validator is to turn
> > > >automatic form validation off, override the
> > > validate method in your
> > > >ActionForm, but there simply invoke the
> validator
> > > manually just as
> > > >Struts would have done with automatic
> validation.
> > > This gives you a
> > > >chance to insert a switch before invoking the
> > > validator.
> > > >
> > > >Probably there are others on the list who know
> a
> > > lot more about this
> > > >than me and might have a better idea. Hope that
> > > helps.
> > > >
> > > >Erik
> > > >
> > > >
> > > >t t wrote:
> > > >
> > > >
> > > >
> > > >>The problem is, when the form is submitted, it
> > > will be validated according to the validator.
> then
> > > error will occur since the user didn't intend to
> > > submit and he/she didn't fill other required
> > fields.
> > >
> > > >>And in my "acion" program, I don't know how to
> > > tell whether it was submitted by "javascript" or
> > by
> > > the "submit" button.
> > > >>Any idea about that?
> > > >>Thanks.
> > > >>
> > > >>t t wrote:
> > > >>
> > > >>Thank you for the hint. I will try.
> > > >>Erik Weber wrote:I don't know exactly how do
> it
> 
=== message truncated ===



                
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


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

Reply via email to