Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is this a real bug in Safari?

Status
Not open for further replies.

bluehope

Technical User
Jun 16, 2008
3
CA
Hello everyone

I have a problem with Safari. I am sending my codes...they work in Firefox, but in Safari they have a problem.

When you choose option "Missing" in drop down menu, the item "no" in radio button has to be disabled, right?
In Firefox it works well, but in Safari it remains able.
Can anybody help me to solve this problem in Safari?
My codes are as below:

<html>
<body>

<?php

echo " <script language='JavaScript' type='text/JavaScript'>";

echo "function switch_id(in_id){";
echo "if (document.getElementById(in_id).disabled)";
echo "{";
echo "document.getElementById(in_id).disabled = false;";
echo "}else{";
echo "document.getElementById(in_id).disabled = true;";
echo "document.getElementById(in_id).checked = false;";
echo "}";
echo "}";

echo "</script>";

echo "<select name='EN' id='EN'>
<option value='-99 '>Select
<option value='1'>No
<option value='2'>Mild
<option value='3'>Moderate
<option value='4'>Severe
<option value='5' onClick=\"switch_id('q2_no')\"> Missing ";
echo "</select>";

echo "<input type='radio' name='q2' id='q2_yes' value='yes'>yes";
echo "<input type='radio' name='q2' id='q2_no' value='no' >no";
?>
</body>
</html>
 
Instead of using "onclick" on the option itself, you should use "onchange" on the select element, and use the value of the select element to determine whether to enable or disable the radio button.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Hi Dan

Thanks for your reply. But I need to disable radio button by selecting one of the options itself in drop down menu...based on your advice by selecting every options in drop down menu the "NO" radio button will be disabled.

Thank you
Bluehope
 
Re-read my advice, taking note of the highlighted text:

Me said:
Instead of using "onclick" on the option itself, you should use "onchange" on the select element, [!]and use the value of the select element to determine whether to enable or disable the radio button.[/!]

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top