Using <html:button> instead of <html:submit>

Tim Jian



-----Original Message-----
From: Ramadoss Chinnakuzhandai [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 02, 2004 2:07 PM
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


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

Reply via email to