Jump to content

set radio button


blic

Recommended Posts

Hi, I have 2 radio buttons and one field. I want to be able to, depending on the user clicking on the field, set the radio button to disabled before submitting the form. How do I do it?

 

I have this, and I wanted the function set_radio to disable the radio buttons:

$v1=$v2 = ""

<input TYPE="radio" NAME="prtype" VALUE="nose" <?= $v1 ?>>Nose

<input TYPE="radio" NAME="prtype" VALUE="mouth" <?= $v2 ?>>Mouth

<input type="text"  name="text1" maxlength="10" class="entry" onclick="set_radio()" value="<?= $text1 ?>">

 

function set_radio(){

//set v1 and v2 to disabled

}

 

 

I

Link to comment
https://forums.phpfreaks.com/topic/238718-set-radio-button/
Share on other sites

This is a javascript task.

 

<script>
function set_radio() {
  document.getElementById('v1').disabled=true;
  document.getElementById('v2').disabled=true;
}
</script>
<input id="v1" TYPE="radio" NAME="prtype" VALUE="nose">Nose
<input id="v2" TYPE="radio" NAME="prtype" VALUE="mouth">Mouth
<input type="text"  name="text1" maxlength="10" class="entry" onclick="set_radio()" value="<?= $text1 ?>">

 

I believe it is .disabled = true, but I would verify that.

Link to comment
https://forums.phpfreaks.com/topic/238718-set-radio-button/#findComment-1226693
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.