Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.