function troubles

Results 1 to 4 of 4

Thread: function troubles

  1. #1
    Bobby Guest

    Default function troubles

    is there a different way to do this. I am trying to read a textfield, determine if it&#039;s value matches PO and sen submit the form to one or the other link depending on whether the condition matches or not. I have determined that the value of the textfield is coming through, but the function is not working. I have tried to put the onSubmit command in the body tag and in the form tag, neither work. I also took the action tag out of the form. When I click the submit button on the form it resets the form, that&#039;s all it does.<BR> function goLink() { <BR> if(document.form1.payment_method.value=="PO"){ <BR> window.location.replace("");} <BR> else {<BR> window.location.replace(""); }<BR> }

  2. #2
    Bobby Guest

    Default function troubles Continued

    I replaced the [window.location.replace("] with [document.write("yes")] and the other instance was replaced with no. I also put an onClick here &#060;input type="submit" name="Confirm" value="Submit" onClick="goLink();"&#062; It replies exactly as it should with this. Now can anyone tell me how to make it link to the 2 pages i need it to instead of writing yes or no , like it does now. I think I may be doing the onSubmit wrong. Where should I put that. When I use on submit it reloads the same page.

  3. #3
    Arky Guest

    Default RE: function troubles

    You use the window.location.href="";<BR>it seems to work better

  4. #4
    Arky Guest

    Default RE: function troubles Continued

    If you want a function to go to a specific place and submit a form do this type=button.<BR><BR>&#060;input type=button value="LETS GO" onClick="gotofunction(form)"&#062;<BR><BR>the script:<BR>function gotofunction(form)<BR>{<BR>//you could insert conditional code here to (if else)<BR>document.form1.action=""; <BR>form.submit();<BR><BR>//or if you dont want to process or send form inputs just do what you did before with window.location.href=""<BR>}

Posting Permissions

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