Topic
  • 2 replies
  • Latest Post - ‏2015-06-04T23:41:03Z by IBMNovice
SystemAdmin
SystemAdmin
7615 Posts

Pinned topic Disable radio button

‏2013-04-04T09:34:49Z |
Hello Everyone,
Please suggest suitable approaches to achieve the below:

Scenario : have a coach with multiple options selectable by radio buttons, i have to check for a text box for a certain value, and if the value does not match a certain criteria, one of the radio buttons have to be greyed out.

I can have the validations done in a js, but again this would mean that the validation would happen only after all the valued have been entered and on the click of the submit button.

Can anyone point me in the right direction that would give me a way to achieve a solution for the Scenario...?

Thanks!!!
G
Updated on 2013-04-04T16:03:16Z at 2013-04-04T16:03:16Z by BornikChatterjee
  • BornikChatterjee
    BornikChatterjee
    129 Posts

    Re: Disable radio button

    ‏2013-04-04T16:03:16Z  
    Hi G,

    You can do that by adding javascript function and calling it on onChange event of text area to check for criteria. Then you don't need wait for the page submission. You can disable that radio button using CSS and javascript which I think you already know.

    Bornik
  • IBMNovice
    IBMNovice
    3 Posts

    Re: Disable radio button

    ‏2015-06-04T23:41:03Z  
    Hi G,

    You can do that by adding javascript function and calling it on onChange event of text area to check for criteria. Then you don't need wait for the page submission. You can disable that radio button using CSS and javascript which I think you already know.

    Bornik

    Hi Bornik,

    Could you please paste the code that would go in change() that disables the radio button?

    I tried the below and it didn't work for me:

     

    var radioButton = this.context.element.querySelector("select");
    radioButton.disabled = true;

     

    Thanks,

    IN.