You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kiet Nguyen <KN...@coolcast.com> on 2001/06/13 16:28:42 UTC
javascript multiple submit
I'm trying to use javascript to submit a form. The javascrip function get
called, but the form is not submited (i.e. the ActionClass doesn't execute)
Here is my jsp.
.....
<script language="JavaScript">
function transmitMessage(msgAction) {
document.orderRegularForm.action = "/dgonline/workOrderSubmit.do";
document.orderRegularForm.submit(document.orderRegularForm);
}
.............
<html:form action="workOrderRegular">
<a href="#"><img src="images/submit.gif" onClick="transmitMessage('Submit
Order')"></a>
</htm:form>
===My config.xml file
<action path="/workOrderSubmit"
type="com.dgsystems.dgonline.struts.order.OrderRegularSubmitAction"
name="orderRegularForm">
</action>
Re: javascript multiple submit
Posted by Klaus Thiele <kt...@pi-ag.com>.
Hi,
i'm not a javascript-specialist, but something like this is working for me:
<a href="javascript:document.forms[0].action.value='Create';document.forms[0].submit();">
Am Mittwoch, 13. Juni 2001 16:28 schrieben Sie:
> I'm trying to use javascript to submit a form. The javascrip
> function get called, but the form is not submited (i.e. the
> ActionClass doesn't execute) Here is my jsp.
>
> .....
> <script language="JavaScript">
> function transmitMessage(msgAction) {
> document.orderRegularForm.action = "/dgonline/workOrderSubmit.do";
> document.orderRegularForm.submit(document.orderRegularForm);
> }
> .............
> <html:form action="workOrderRegular">
> <a href="#"><img src="images/submit.gif"
> onClick="transmitMessage('Submit Order')"></a>
> </htm:form>
>
>
> ===My config.xml file
> <action path="/workOrderSubmit"
>
> type="com.dgsystems.dgonline.struts.order.OrderRegularSubmitAction"
> name="orderRegularForm">
> </action>
--
Klaus Thiele - Personal & Informatik AG
mailto:kth@pi-ag.com
"Your mouse has moved.
Windows must be restarted for the change to take effect."
Re: javascript multiple submit
Posted by Peter Alfors <pe...@irista.com>.
Looks like javascript does not know the name of your form.
I have not used the html:form tag before, but from looking at the code, it does
not look like having the form named in your
xml document is going to set the form name. The html:form tag takes an
attribute 'name' that you could set:
<html:form name="orderRegularForm" action="workOrderRegular">
or you could change your javascript to access the form as an index value such
as:
document.forms[0].action = "/dgonline/workOrderSubmit.do";
document.forms[0].submit();
where 0 = first form defined on your page.
HTH,
Pete
Kiet Nguyen wrote:
> I'm trying to use javascript to submit a form. The javascrip function get
> called, but the form is not submited (i.e. the ActionClass doesn't execute)
> Here is my jsp.
>
> .....
> <script language="JavaScript">
> function transmitMessage(msgAction) {
> document.orderRegularForm.action = "/dgonline/workOrderSubmit.do";
> document.orderRegularForm.submit(document.orderRegularForm);
> }
> .............
> <html:form action="workOrderRegular">
> <a href="#"><img src="images/submit.gif" onClick="transmitMessage('Submit
> Order')"></a>
> </htm:form>
>
> ===My config.xml file
> <action path="/workOrderSubmit"
>
> type="com.dgsystems.dgonline.struts.order.OrderRegularSubmitAction"
> name="orderRegularForm">
> </action>
RE: javascript multiple submit
Posted by Abraham Kang <ab...@infogain.com>.
Hi Kiet,
I think you need to sprinkle some alerts through out your transmitMessage
function. You also might want to change:
document.orderRegularForm.submit(document.orderRegularForm);
to:
document.orderRegularForm.submit();
and finally do a "View Source" on your page to make sure the form name is
correct.
--Abraham
> -----Original Message-----
> From: Kiet Nguyen [mailto:KNguyen@coolcast.com]
> Sent: Wednesday, June 13, 2001 7:29 AM
> To: Struts-User (E-mail)
> Subject: javascript multiple submit
>
>
> I'm trying to use javascript to submit a form. The javascrip function get
> called, but the form is not submited (i.e. the ActionClass
> doesn't execute)
> Here is my jsp.
>
> .....
> <script language="JavaScript">
> function transmitMessage(msgAction) {
> document.orderRegularForm.action = "/dgonline/workOrderSubmit.do";
> document.orderRegularForm.submit(document.orderRegularForm);
> }
> .............
> <html:form action="workOrderRegular">
> <a href="#"><img src="images/submit.gif"
> onClick="transmitMessage('Submit
> Order')"></a>
> </htm:form>
>
>
> ===My config.xml file
> <action path="/workOrderSubmit"
>
> type="com.dgsystems.dgonline.struts.order.OrderRegularSubmitAction"
> name="orderRegularForm">
> </action>
>
>
>
>