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 <[EMAIL PROTECTED]> 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 using JavaScript. However, I know there's a way to do it. But, you'd have to have all list data downloaded to the client's browser (could be undesirable depending on list size), so you may want to rethink that approach once you figure out how to do it.


Obviously it can be done using ordinary programming on the server side (JavaScript can resubmit the page when the first select's value is changed, and you can change the collection to be displayed in the second select before you resend the HTML).

Erik


t t wrote:





Hi, all,
I have two html:select as below:
---------------------------------------------------





labelProperty="label"/>






labelProperty="label"/>




--------------------------------------------------------
when user choose item2 from s1, I want to change the collection in s2





from "c2" to "itemC". How can I do that?




Thanks in advance!
Tong



---------------------------------
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]




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

---------------------------------
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]


__________________________________________________
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]



Reply via email to