Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Redirecting a page

 
Phil Perkins
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to redirect using the following code
Can someone help me find the bug? PageDirect is the page that it is getting directed to.

<script language="JavaScript">
<!-- Hide the script form non-JavaScript browsers
function goToLink(form)
{
window.location.href = form.options[form.selectedIndex].value;
}
//-->
</script>
<input type="radio" name="PageDirect" value="http://www.webmonkey.com"> Billing Information
<input type="radio" name="PageDirect" value="adminInfo.html"> Administration Information
<input type="radio" name="PageDirect" value="primaryUserInfo.html" checked> Primary Location
<input type="radio" name="PageDirect" value="otherUserInfo.html"> Secondary Location(s)
<input type="submit" value="Go" onClick="goToLink(this.form.PageDirect">
</form>
thanks
 
bill bozeman
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
options is not a command for radio buttons. You need to use a script that loops through the radio buttons and checks the checked status, then when you find the one that is checked, get that value. The function could look something like this:

Didn't test that, but it would look something like that.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic