• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Redirecting a page

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't destroy the earth! That's where I keep all my stuff! Including this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic