Isn't that what the onsubmit attribute in your <html:form> is for?

> --- "Au-Yeung, Stella H" <[EMAIL PROTECTED]> wrote:

But I don't always want "/app/fdd/shopWorkOrder/fromCreateShopWorkOrder" to
be my action all the time.   I want the action for the form to be "dynamic"
and depends on the form field "whichAction".  That's why I created the
javascript function submitForm(frm) to pick the action "dynamically".  In
other words, I have <action mapping> in my struts-config.xml file for both
path "/app/fdd/shopWorkOrder/fromCreateShopWorkOrder" and
"/app/fdd/shopWorkOrder/fromUpdateShopWorkOrder".  But I want whichever one
to be chosen to be "dynamically". So  how I do that all within the
<html:form> tag?


--- Hubert Rabago <[EMAIL PROTECTED]> wrote:
> I never said anything close to what you're asking me.
> All I said is choose one of your two possible outcomes (doesn't matter
> which
> one), take the path that you gave it in the struts-config.xml, then use
> that
> in your <html:form>.  
> Let's say you have the ff entry in your struts-config:
> 
> <action path="/fromCreateShopWorkOrder" ...
>     name="theForm">
>     <forward .../>
> </action>
> 
> then in your html:form, specify that action:
> 
> <html:form action="/fromCreateShopWorkOrder" 
>            method="post" 
>            onsubmit="return submitForm(document.theForm)">
> ...
> </html:form>
> 
> You do have <action>'s associated with fromCreateShopWorkOrder and
> fromUpdateShopWorkOrder, right?
> 
>  - Hubert
> 
> 
> --- "Au-Yeung, Stella H" <[EMAIL PROTECTED]> wrote:
> > Hubert:
> > Can you elaborate that.... In othe words, how do I do everything that the
> > function submitForm() does to dynamically pick an action all within the
> > <html:form> tag? 
> > 
> > -----Original Message-----
> > From: Hubert Rabago [mailto:[EMAIL PROTECTED] 
> > Sent: Monday, February 23, 2004 4:36 PM
> > To: Struts Users Mailing List
> > Subject: Re: Must have action="....." in <html:form> tag?
> > 
> > 
> > Specify the Action associated with "fromCreateShopWorkOrder" or
> > "fromUpdateShopWorkOrder" in the <html:form> attribute.
> > 
> > --- "Au-Yeung, Stella H" <[EMAIL PROTECTED]> wrote:
> > > Hi:
> > > My <html:form> tag doesn't allow me to skip an 'action' attribue.   If
> > you
> > > look at my code below, I move the assignment of the 'form action'  to 
> > > the javascript function so which action to take is dynamically depends 
> > > on the form element 'whichAction'.  But the compiler insist I have to 
> > > have the 'action' property right inside the <html:form> tag.  But that
> > doesn't allow
> > > me to choose the action dynamically.   Does anyone have any suggestion?
> > > 
> > > <script language = "Javascript">
> > > function submitForm(frm)
> > > {
> > >    var whichAction=frm.elements("whichAction")
> > > 
> > >    if (whichAction == "create")
> > >    {
> > >       document.theForm.action = 
> > > "/app/fdd/shopWorkOrder/fromCreateShopWorkOrder;
> > >    }
> > >    else
> > >    {
> > >       document.theForm.action = 
> > > "/app/fdd/shopWorkOrder/fromUpdateShopWorkOrder;
> > >    }
> > > 
> > >    return true;
> > > }
> > > </script>
> > > 
> > > 
> > > <jsp:useBean id="ShopWorkOrderBean" scope="request"
> > >  
> > > class="com.cat.sdl.fdd.formBean.shopWorkOrder.ShopWorkOrderForm"/>
> > > <html:form name="theForm" method="post" onSubmit="return 
> > > submitForm(document.theForm)">
> > > 
> > > 
> > > I got the following error with the above code:
> > > Parsing of JSP File '/app/fdd/shopWorkOrder/CreateTLFPart.jsp' failed:
> > > /app/fdd/shopWorkOrder/CreateTLFPart.jsp(28): required attribute
> 'action'
> > > not specified for tag 'form'
> > > probably occurred due to an error in
> > > /app/fdd/shopWorkOrder/CreateTLFPart.jsp line 28:
> > > <html:form name="theForm" method="post" onSubmit="return
> > > submitForm(document.theForm)">
> > > 
> > > 
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > 
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Mail SpamGuard - Read only the mail you want.
> > http://antispam.yahoo.com/tools
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail SpamGuard - Read only the mail you want.
> http://antispam.yahoo.com/tools
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools

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

Reply via email to