Redirection based on form input.. easy question

Results 1 to 2 of 2

Thread: Redirection based on form input.. easy question

  1. #1
    Join Date
    Dec 1969

    Default Redirection based on form input.. easy question

    Hello,<BR><BR> I have a form with three radio buttons, i want the form to redirect the user based on which radio button they select.<BR><BR>Example:<BR><BR>[input type="radio" name="memberstatus" value="new"]<BR>[input type="radio" name="memberstatus" value="exsisting"]<BR>[input type="radio" name="memberstatus" value="stickerrequest"]<BR><BR>I want:<BR><BR>"new" to go to /hircc/join/how/newmember.asp<BR>"exsisting" to /hircc/join/how/memberrenew.asp<BR>"stickerrequest" to /hircc/join/how/stickerrequest.asp<BR><BR> What do I have to do to do this? It seems simple enough, but I do not have much experiance with forms. Any help is greatly appreciated.<BR><BR>Tom -<BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Redirection based on form input.. easy questio

    This requires some scripting.<BR>Example:<BR>&#060;input type=submit name=submit value=submit onclick="redirect();return false"&#062; (The return false keeps the form from submitting)<BR>&#060;script&#062;<BR>function redirect(){<BR> with (document.forms.formNameHere.memberstatus) {<BR> if (value=="new") {<BR> location.href="/hircc/join/how/newmember.asp"<BR> }<BR> else if (value=="existing"){<BR> location.href="/hircc/join/how/memberrenew.asp"<BR> }<BR> else if (value=="stickerrequest") {<BR> location.href="//hircc/join/how/stickerrequest.asp"<BR> }<BR> }<BR>}<BR><BR>Or you could put the onlcick event on each radio button if you don&#039t want them to have to click on a submit button. Or, since I see you are using ASP, you could use the following server-side code on the page specified by the action property of your form tag (which could theoretically be the same page):<BR>&#060;%<BR>select case request("memberstatus")<BR> case "new"<BR> response.redirect "/hircc/join/how/newmember.asp"<BR> case "existing"<BR> etc, etc.<BR>end select<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