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
    Jul 2002
    Posts
    362
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Radio action buttons not responding

    I am trying to get my radio buttons to have two choices where each one takes me to a different action page. It keeps giving me the error:

    document.queryForm.myAction2 is null or not an object

    Here is my attempt:
    Code:
    <SCRIPT language="JavaScript">
    
    
    
    function do_submit()
            {
            if (document.queryform.myAction2[0].checked)
                {
                document.queryform.action = 'PageOne.cfm';
                //document.queryform.submit();  it bombs with or without this line uncommented
    
                }
            else if (document.queryform.myAction2[1].checked)
                {
                document.queryform.action = 'PageTwo.cfm';
               // document.queryform.submit();  it bombs with or without this line uncommented
                }
            }
    </SCRIPT>


    The calling area and radio buttons:
    Code:
    <FORM METHOD="post" NAME="queryForm"  onsubmit="do_submit();">
    ....
    <input type="radio" name="myAction2" checked> first action<br>
    <input type="radio" name="myAction2"> second action
    Please advise.

  • #2
    New Coder
    Join Date
    May 2004
    Location
    Some place called the Earth I think...
    Posts
    99
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Just go

    <input type="radio" onfocus="window.location='theUrl.htm';"><br>
    <input type="radio" onfocus="window.location='theUrl2.htm';">
    Dont do drugs, get high on life

    13 years and getting nowhere fast.....


    đ­˘M_M÷˝kŔą

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Posts
    362
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That didnt work. Any other suggetions?

  • #4
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try using: document.forms['FormName'].setAttribute('action',radioButtonValue)

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    You had it right the first time except you were not case sensitive. Your form is named queryForm with a capital F yet you are referencing it as queryform. Case counts in JavaScript.


  •  

    Posting Permissions

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