It is often required that you need to send the data in the same form to
different server-side scripts depending one certain criteria. JavaScript
allows you to modify the action field of an HTML form dynamically.
Multiple submit buttons
It is possible to have more than one submit button in a form. The example below shows how to switch the action field based on the submit button pressed.
<script type= "text/javascript" >
function OnSubmitForm()
{
if (document.pressed == 'Insert' )
{
document.myform.action = "insert.html" ;
}
else
if (document.pressed == 'Update' )
{
document.myform.action = "update.html" ;
}
return true ;
}
</script>
|
No comments:
Post a Comment