Problem with radio buttons and enable disable other buttons

Issues related to forms.
Post Reply
FRANCISCO2020
 
 
Posts: 10
Joined: Fri Nov 20, 2020 11:13 am

Problem with radio buttons and enable disable other buttons

Post by FRANCISCO2020 »

Hello, the problem is that I have 2 radio buttons and I configure them to simply activate or deactivate other form-type buttons that take us to another page, but never deactivate them. If I program it to hide them if it does so but not deactivate them.

Code: Select all

<!doctype html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>Página sin título</title>
<meta name="generator" content="DOELECTRIC">
<link href="css/index.css" rel="stylesheet">
<script src="js/jquery-1.12.4.min.js"></script>
<script>
$(document).ready(function()
{
   $("#RadioButton1").change(function()
   {
      if ($('#RadioButton1').is(':checked'))
      {
         $('#Button2').prop('disabled', true);
      }
   });
   $("#RadioButton1").trigger('change');
   $("#RadioButton2").change(function()
   {
      if ($('#RadioButton2').is(':checked'))
      {
         $('#Button1').prop('disabled', true);
      }
   });
   $("#RadioButton2").trigger('change');
});
</script>
</head>
<body>
<div id="wb_RadioButton1" style="position:absolute;left:17px;top:79px;width:36px;height:37px;z-index:0;">
<input type="radio" id="RadioButton1" name="boton_opcion" value="1" checked style="position:absolute;left:0;top:0;" title="BOTON OPCION"><label for="RadioButton1"></label></div>
<div id="wb_RadioButton2" style="position:absolute;left:17px;top:130px;width:36px;height:37px;z-index:1;">
<input type="radio" id="RadioButton2" name="boton_opcion" value="2" style="position:absolute;left:0;top:0;" title="BOTON OPCION"><label for="RadioButton2"></label></div>
<label for="" id="Label2" style="position:absolute;left:388px;top:18px;width:186px;height:20px;line-height:24px;z-index:2;">MODO DE FUNCIONAMIENTO</label>
<a id="Button1" href="./telerrup.html" onclick="window.location.href='./telerrup.html';return false;" style="position:absolute;left:55px;top:79px;width:198px;height:37px;z-index:3;">Telerruptor</a>
<a id="Button2" href="./telerrup.html" onclick="window.location.href='./telerrup.html';return false;" style="position:absolute;left:55px;top:130px;width:198px;height:37px;z-index:4;">Temporizador de escalera</a>
</body>
</html>





Tested on crhome and firefox

Thanks for the help.
User avatar
Pablo
 
Posts: 21712
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Problem with radio buttons and enable disable other buttons

Post by Pablo »

If you need help then please share a demo project so I can see all your setting. The HTML code is not useful.
Also, describe exactly what you are trying to do.

Related FAQ:
https://www.wysiwygwebbuilder.com/forum ... 10&t=82134

Note that hiding an element is not the same as disabling it.
FRANCISCO2020
 
 
Posts: 10
Joined: Fri Nov 20, 2020 11:13 am

Re: Problem with radio buttons and enable disable other buttons

Post by FRANCISCO2020 »

Hello
http://test.doelectric.com/test1.html

Pressing the radio buttons what you have to do is disable the programmed button so that it does not perform any action
User avatar
Pablo
 
Posts: 21712
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Problem with radio buttons and enable disable other buttons

Post by Pablo »

Note that you cannot disable links. The 'disable' attribute is only available for form input elements.
https://www.w3schools.com/tags/att_input_disabled.asp
FRANCISCO2020
 
 
Posts: 10
Joined: Fri Nov 20, 2020 11:13 am

Re: Problem with radio buttons and enable disable other buttons

Post by FRANCISCO2020 »

ok, And what kind of button can I put that I can enable and disable
User avatar
Pablo
 
Posts: 21712
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: Problem with radio buttons and enable disable other buttons

Post by Pablo »

The following HTML elements can be disabled:
- editbox
- text area
- submit button
- reset button
- radio button
- checkbox
- flip switch

Note that a link button is not really a button, it's just a link with the appearance of the button. It is not a form input field.

If you want to disable clicks on another item then you can use JavaScript:
https://www.w3schools.com/cssref/css3_p ... events.asp
FRANCISCO2020
 
 
Posts: 10
Joined: Fri Nov 20, 2020 11:13 am

Re: Problem with radio buttons and enable disable other buttons

Post by FRANCISCO2020 »

OK,
Thanks for the help.
Post Reply