Ramadoss: That's what I did already in one of my original version. My reason of posting to this group is because <html:form> doesn't allow me to use a dynamically assigned "action" (such as one I set in my Javascript function to replace the one I have within the <html:form> tag.
-----Original Message----- From: Ramadoss Chinnakuzhandai [mailto:[EMAIL PROTECTED] Sent: Monday, February 23, 2004 7:10 PM To: Struts Users Mailing List Subject: RE: Must have action="....." in <html:form> tag? I'm not sure this but you can try... Create Main screen ****(define a attribute in your form which holds the value of "which screen" and set update/create before dispatch) ----> use 'theForm' to input data ****(here check that attribute value whether it is create/update and assign the same to the action path either your JavaScript sumbit or whatever ) --------> return back to Create main -R -----Original Message----- From: Au-Yeung, Stella H [mailto:[EMAIL PROTECTED] Sent: Monday, February 23, 2004 6:08 PM To: 'Struts Users Mailing List' Subject: RE: Must have action="....." in <html:form> tag? Shyam: I am not sure what you mean, can you elaborate that? The current form only has one 'submit' button. After the user fills in data on the current form, I want the data to be submitted to the DB and then automatically be taken back to the 'previous' screen. This previous screen can be a 'Create main screen' or an 'Update main screen'. I use a hidden field 'whichAction' to "remember" which is the 'previous' screen. So when the user submits the input data on the cuurrent form, that's when the javascript submitForm() function decides which screen (/app/fdd/shopWorkOrder/fromCreateShopWorkOrder or /app/fdd/shopWorkOrder/fromUpdateShopWorkOrder) to return to. Example: Create Main screen ----> use 'theForm' to input data --------> return back to Create main Update Main screen -----> use 'theForm' to input data --------> return back to Update main (this screen 'theForm' is where I decide which precious screen to return to based on the hidden field "whichAction". That's why <form action> has to be dynamic My user only wants "ONE" submit button on "theForm" and the application should be smart enough to return to the correct 'previous' page. -----Original Message----- From: Shyam A [mailto:[EMAIL PROTECTED] Sent: Monday, February 23, 2004 5:31 PM To: Struts Users Mailing List Subject: RE: Must have action="....." in <html:form> tag? Just a suggestion. Not sure if I'm right... Instead of using onSubmit() event of your <html:form>, why don't you call the Javascript when the user clicks/submits the associcated HTML component - "Create/Update button", and set the action accordingly. HTH, Shyam --- "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? > > -----Original Message----- > From: Hubert Rabago [mailto:[EMAIL PROTECTED] > Sent: Monday, February 23, 2004 4:58 PM > To: Struts Users Mailing List > Subject: RE: Must have action="....." in <html:form> > tag? > > > 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] > > --------------------------------------------------------------------- > 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] --------------------------------------------------------------------- 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]

