sumit form

Results 1 to 4 of 4

Thread: sumit form

  1. #1
    kiko Guest

    Default sumit form

    I have a form which submits to a process page when user clicks on a submit button while on the same form i have a cancel button and I want to redirect the user to a different page when they hit cancel button .....any idea how can i do it...<BR>thanks

  2. #2
    Steve Cimino Guest

    Default RE: sumit form

    Wow, I hope you don&#039;t talk the way you write... looks like you&#039;ll be breathless.<BR><BR>Change the form action through the use of JS.<BR><BR>if (button1) document.formname.action = "page1.asp";<BR>else document.formname.action = "page2.asp";

  3. #3
    kiko Guest

    Default RE: sumit form

    I have it in my js like this<BR><BR>function FormSubmit() <BR><BR>{<BR> <BR> //initialiaze variable<BR><BR> var strMsg = "";<BR><BR> <BR><BR> //strMsg = strMsg + (!(document.login.userName.value.length &#062; 0) ? "Login ID, " : "");<BR><BR> strMsg = strMsg + (!(document.login.userPassword.value.length &#062; 0) ? "Password, " : "");<BR><BR> <BR> if (strMsg.length &#062; 0) <BR><BR> {<BR><BR> alert("The following field(s) must be completed:
    " + strMsg.substr(0, strMsg.length - 2));<BR><BR> return false;<BR><BR> }<BR><BR> else {//return true;}<BR><BR><BR>if (button1) document.login.action = "securityloginrespond.asp"; <BR>else document.login.action = "welcome2.htm"; <BR>} <BR><BR>}<BR><BR>&#060;/SCRIPT&#062;<BR><BR>and in my form like this<BR>&#060;form action="securityloginrespond.asp" method="POST" name="login" &#062;<BR><BR>&#060;input type="button" value="Submit" name="button1" onclick="FormSubmit();" &#062;&nbsp;&nbsp;<BR> &#060;input type="button" value="Cancel" name="button1" onclick="welcome2.htm" onclick="FormSubmit();" <BR>&#062;<BR>it is giving me error button1 not defined any ideas<BR><BR>tahnks<BR>

  4. #4
    Steve Cimino Guest

    Default Because that was pseudocode

    It&#039;s impossible for me to determine what you app was doing, so I just use names, figuring you would plug in what you needed.<BR><BR>First of all, you have two buttons with the same name. Need to change that. Secondly, we&#039;ll have to pass the name of the button to your function.<BR><BR>&#060;input type="button" value="Submit" name="GO" onclick="FormSubmit(;" &#062; <BR>&#060;input type="button" value="Cancel" name="CANCEL" onclick="welcome2.htm" onclick="FormSubmit(;" <BR><BR> will pass the name of the button. Change the beginning of your function to accept this value:<BR><BR>function FormSubmit(buttonname) <BR><BR>Now, we&#039;ll check:<BR><BR>if (buttonname == "GO") document.login.action = "securityloginrespond.asp"; <BR>else document.login.action = "welcome2.htm"; <BR><BR><BR>Don&#039;t forget to add your form submit function, or you ain&#039;t going anywhere.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts