Hi, David, Thanks. I think I know where is the problem after reading your last email again. I will try it later. Tong --- "David G. Friedman" <[EMAIL PROTECTED]> wrote:
> Tong, > > When you say "automatic validation", do you mean > client side or server side? > What class does your ActionForm extend? What class > does your Action extend? > What is your action mapping? What path (the part > after the > http://www.whatever.com) is the action? What are > html:form and > html:javascript tags from your invoking page? (i.e. > the one that submits the > page). > > Regards, > David > > -----Original Message----- > From: t t [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 10, 2004 8:05 PM > To: Struts Users Mailing List > Subject: RE: Help needed on question regarding > html:select and > html:options...cannot turn off validator > > > 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 > === message truncated === __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]