Helpful Information
 
 
Category: ColdFusion Development
Change Action property

Hi all,

I am new here. I want to have 2 submit buttons(EDIT and DELETE) for the same form. If you press one button, you go to one page and if you press the other button you go to the other page. I think javascript might be helpful. But my script does not work. Any suggestions? Really appreciate if you would help!

Here is my script:


<HEAD>
<TITLE>Management</TITLE>

<script>
function Edit()
{
document.myForm.action =
"user_edit.cfm"
document.myForm.submit();
}

function Delete()
{
document.myForm.action =
"user_delete.cfm"
document.myForm.submit();
}
</script>
</HEAD>

<CFQUERY NAME="USERLIST" DATASOURCE="usermanage">
SELECT USR_ID, USR_FNAME, USR_MNAME, USR_LNAME FROM USER ORDER BY USR_LNAME, USR_FNAME, USR_MNAME
</CFQUERY>


<BODY BGCOLOR="LIGHTBLUE">
<CENTER><H1>Management</H1>

<TABLE>
<TR>


<TD VALIGN="top">
<FORM NAME="myform" METHOD="post">
<SELECT NAME="USR_ID" SIZE 20>
<CFOUTPUT QUERY="USERLIST">
<OPTION VALUE="#USERLIST.USR_ID#">[#USR_ID#] - #USR_LNAME#,#USR_FNAME# #USR_MNAME#
</CFOUTPUT>
</SELECT>
<INPUT TYPE="hidden" NAME="USR_ID_required" VALUE="USR_ID is required">
</TD>
<TD VALIGN="top">
<INPUT TYPE="Submit" VALUE="Edit" ONCLICK="Edit()">
<INPUT TYPE="Submit" VALUE="Delete" ONCLICK="Delete()">
</TD>

</FORM>



Thanks,
problem99

what part of your script doesn't work? what kind of errors are you getting? what does this page do?










privacy (GDPR)