Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    May 2004
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help needed with If and else

    Hello everyone,

    any help will be greatly appreciated.

    I have an email form. On the " if " function, it verifies the form. that's ok. but on the " else " function, I would like the form to continue to submit but also go to a page called " thankyou.html ". Between the code listed below:

    else
    return true;

    is there a way to insert between these lines to redirect to a new URL - inside this same window - after the form has been submitted. If so, what is this code? Perhaps I can insert the code also inside the " action " in the form? I really need some help, and would appreciate anyone's input.

    Thank you kindly.

  • #2
    Regular Coder dswimboy's Avatar
    Join Date
    Nov 2003
    Location
    mostly in Ann Arbor
    Posts
    458
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i would recommend creating a hidden field. set the field to true or false. on the action, test for trueness. then redirect from the action script.
    "There is more than one way to do it."

  • #3
    Regular Coder
    Join Date
    May 2004
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello,

    thank you for your reply. I really don't know javascript, so would it be possible to let me know exactly what this hidden field would be written like with this true or false and where exactly I would place it in the code? I would really appreciate it.

    Thank you very much in advance.

  • #4
    Senior Coder
    Join Date
    Feb 2004
    Posts
    1,206
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So you want to submit to thankyou.html or do you want to submit to some other page, but end up on thankyou.html? In other words, what action have you set in your form?

    Also when you're talking about this if and else, I'm not sure I follow:
    If - validates the form and submits it if it validates, or alerts the user that the form did not validate.
    Else - Doesn't validate the form, just submits it.

    In both cases it sends the user to a thankyou.html page?

    Please try to be as unambiguous as possible as it's hard to give a solution when you're half guessing.. so let us know.

    Sadiq.

  • #5
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    add location.replace or location.href to the bottom of your vaidation function and call onsubmit


  •  

    Posting Permissions

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