struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Takhar, Sandeep" <Sandeep.Tak...@CIBC.ca>
Subject RE: Form submit in JavaScript
Date Fri, 02 Apr 2004 19:12:38 GMT
you've spelt it sumbit and submit

sandeep

-----Original Message-----
From: Ramadoss Chinnakuzhandai [mailto:rchinnakuzhandai@register.com]
Sent: Friday, April 02, 2004 2:07 PM
To: struts-user@jakarta.apache.org
Subject: Form submit in JavaScript


Hi,

I have the following block of code in my jsp

<tr>
 <td colspan="3" align="right">
	<html:submit property="command" value="Delete" onclick="sumbitForm('Delete');return true;"/>
	<html:submit property="command" value="Cancel" onclick="sumbitForm('Cancel');return true;"/>
	<html:submit property="command" value="Save" onclick="sumbitForm('Save');return true;"/>
				
</td>	
</tr>


I hv the following JavaScript function inside the same jsp

<script language="javascript">
    function submitForm(input) {       
	   var action;
	   if(input == "Delete") {action = "/tools/admin_employees.rcmx?method=deleteUser";}
	   else if(input == "Cancel") {action = "/tools/admin_employees.rcmx?method=displayUsers";}
	   else if(input == "Save") {action = "/tools/admin_employees_edituser?method=updateCsrAccount";}
	   
	   document.manageCsrAccountsForm.action = action;
	   document.manageCsrAccountsForm.submit();
	   return true;	   
    }
</script>


When I click on Delete/Cancel/Save button it does not actually invoke javascript function
but submit to the action specified in the <html:form action="action">.

Can anybody guide me where I'm doing wrong...or any better way to do this?

Thank for your time,

-Ramadoss


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


Mime
View raw message