You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by t t <wa...@yahoo.com> on 2004/11/10 17:50:49 UTC
Help needed on question regarding html:select and html:options...
Hi, all,
I have two html:select as below:
---------------------------------------------------
<html:select property="s1">
<html:options collection="c1" property="value"
labelProperty="label"/>
</html:select>
<html:select property="s2">
<html:options collection="c2" property="value"
labelProperty="label"/>
</html:select>
--------------------------------------------------------
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
Re: Help needed on question regarding html:select and html:options...but...
Posted by t t <wa...@yahoo.com>.
Thanks, Erik. I did set it to false. But it's still
been validated when submitted. confusing...
--- Erik Weber <er...@mindspring.com> wrote:
> There is a "validate" attribute to the "action"
> element in
> struts-config.xml. You set it to true or false.
>
>
http://struts.apache.org/userGuide/dev_validator.html
>
> Erik
>
>
> t t wrote:
>
> >How can I turn off validator? THanks.
> >--- t t <wa...@yahoo.com> wrote:
> >
> >
> >
> >>Or I can set a parameter before executing the
> added
> >>action.
> >>--- t t <wa...@yahoo.com> 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 <er...@mindspring.com> 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
>
=== message truncated ===
__________________________________
Do you Yahoo!?
Check out the new Yahoo! Front Page.
www.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Help needed on question regarding html:select and html:options...cannot
turn off validator
Posted by Erik Weber <er...@mindspring.com>.
There is a "validate" attribute to the "action" element in
struts-config.xml. You set it to true or false.
http://struts.apache.org/userGuide/dev_validator.html
Erik
t t wrote:
>How can I turn off validator? THanks.
>--- t t <wa...@yahoo.com> wrote:
>
>
>
>>Or I can set a parameter before executing the added
>>action.
>>--- t t <wa...@yahoo.com> 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 <er...@mindspring.com> 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
>>>>>
>>>>>
>>>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:
>>>>>
>>>>>
>>>user-unsubscribe@struts.apache.org
>>>
>>>
>>>>>For additional commands, e-mail:
>>>>>
>>>>>
>>>user-help@struts.apache.org
>>>
>>>
>>>>>
>>>>>
>>>>>---------------------------------
>>>>>Do you Yahoo!?
>>>>>Check out the new Yahoo! Front Page.
>>>>>
>>>>>
>>www.yahoo.com
>>
>>
>=== message truncated ===
>
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam? Yahoo! Mail has the best spam protection around
>http://mail.yahoo.com
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Help needed on question regarding html:select and html:options...cannot turn off validator
Posted by t t <wa...@yahoo.com>.
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" <hu...@ix.netcom.com> 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:wantte03@yahoo.com]
> 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" <hu...@ix.netcom.com>
> 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:wantte03@yahoo.com]
> > 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 <wa...@yahoo.com> wrote:
> >
> > > Or I can set a parameter before executing the
> > added
> > > action.
> > > --- t t <wa...@yahoo.com> 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 <er...@mindspring.com> 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Help needed on question regarding html:select and html:options...cannot turn off validator
Posted by "David G. Friedman" <hu...@ix.netcom.com>.
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:wantte03@yahoo.com]
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" <hu...@ix.netcom.com> 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:wantte03@yahoo.com]
> 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 <wa...@yahoo.com> wrote:
>
> > Or I can set a parameter before executing the
> added
> > action.
> > --- t t <wa...@yahoo.com> 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 <er...@mindspring.com> 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Help needed on question regarding html:select and html:options...cannot turn off validator
Posted by t t <wa...@yahoo.com>.
Thanks. David. I am still confused by the automatic
validation. I couldn't turn it off.
--- "David G. Friedman" <hu...@ix.netcom.com> 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:wantte03@yahoo.com]
> 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 <wa...@yahoo.com> wrote:
>
> > Or I can set a parameter before executing the
> added
> > action.
> > --- t t <wa...@yahoo.com> 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 <er...@mindspring.com> 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Help needed on question regarding html:select and html:options...cannot turn off validator
Posted by "David G. Friedman" <hu...@ix.netcom.com>.
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:wantte03@yahoo.com]
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 <wa...@yahoo.com> wrote:
> Or I can set a parameter before executing the added
> action.
> --- t t <wa...@yahoo.com> 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 <er...@mindspring.com> 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
> > 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
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Help needed on question regarding html:select and html:options...cannot turn off validator
Posted by t t <wa...@yahoo.com>.
How can I turn off validator? THanks.
--- t t <wa...@yahoo.com> wrote:
> Or I can set a parameter before executing the added
> action.
> --- t t <wa...@yahoo.com> 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 <er...@mindspring.com> 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
> > 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:
> > user-unsubscribe@struts.apache.org
> > >>For additional commands, e-mail:
> > user-help@struts.apache.org
> > >>
> > >>
> > >>
> > >>
> > >>---------------------------------
> > >>Do you Yahoo!?
> > >>Check out the new Yahoo! Front Page.
> www.yahoo.com
> > >>
>
=== message truncated ===
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Help needed on question regarding html:select and html:options... I got an idea.
Posted by t t <wa...@yahoo.com>.
Or I can set a parameter before executing the added
action.
--- t t <wa...@yahoo.com> 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 <er...@mindspring.com> 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
> 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:
> user-unsubscribe@struts.apache.org
> >>For additional commands, e-mail:
> user-help@struts.apache.org
> >>
> >>
> >>
> >>
> >>---------------------------------
> >>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:
> user-unsubscribe@struts.apache.org
> >For additional commands, e-mail:
> user-help@struts.apache.org
> >
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Tired of spam? Yahoo! Mail has the best spam
> protection around
> >http://mail.yahoo.com
>
=== message truncated ===
__________________________________
Do you Yahoo!?
Check out the new Yahoo! Front Page.
www.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Help needed on question regarding html:select and html:options... I got an idea.
Posted by t t <wa...@yahoo.com>.
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 <er...@mindspring.com> 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 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: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>
>>---------------------------------
>>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: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam? Yahoo! Mail has the best spam protection around
>http://mail.yahoo.com
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------
Do you Yahoo!?
Check out the new Yahoo! Front Page. www.yahoo.com
Re: Help needed on question regarding html:select and html:options...
A problem
Posted by Erik Weber <er...@mindspring.com>.
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 <er...@mindspring.com> 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: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>>
>>---------------------------------
>>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: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam? Yahoo! Mail has the best spam protection around
>http://mail.yahoo.com
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Help needed on question regarding html:select and html:options... A problem
Posted by t t <wa...@yahoo.com>.
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 <er...@mindspring.com> 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: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
>---------------------------------
>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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Re: Help needed on question regarding html:select and html:options...
A problem
Posted by Erik Weber <er...@mindspring.com>.
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 <wa...@yahoo.com> 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: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
>---------------------------------
>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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Help needed on question regarding html:select and html:options... A problem
Posted by t t <wa...@yahoo.com>.
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 <wa...@yahoo.com> 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------
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
Re: Help needed on question regarding html:select and html:options...
Posted by t t <wa...@yahoo.com>.
Thank you for the hint. I will try.
Erik Weber <er...@mindspring.com> 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------
Do you Yahoo!?
Check out the new Yahoo! Front Page. www.yahoo.com
Re: Help needed on question regarding html:select and html:options...
Posted by Erik Weber <er...@mindspring.com>.
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:
>---------------------------------------------------
><html:select property="s1">
> <html:options collection="c1" property="value"
> labelProperty="label"/>
> </html:select>
><html:select property="s2">
> <html:options collection="c2" property="value"
> labelProperty="label"/>
> </html:select>
>--------------------------------------------------------
>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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org