radioGroup selected value

Issue #2 closed
Tiago Rodrigues created an issue

Good morning,

How can I check a radio selected field inside of a return function? I have a checkbox and I want to disable it if a radioGroup has a certain value selected.

The radio object:

<lf-radio #lfRadioBlock
                  name="optimizersSelection"
                  [options]="options"
                  [isRequired]="true"
        ></lf-radio>

The checkbox example:

 <lf-checkbox name="coralReefOptimization"
                       [initialValue]="true"
                       [isDisabled]="isDisabled()"
                       label="Coral Reef Optimization"></lf-checkbox>

The javascript code for the radio options:

public options: object[] = [
    {value: 'automatic', text: 'Automatic selection'},
    {value: 'semi-automatic', text: 'Semiautomatic selection'},
    {value: 'manual', text: 'Manual selection'},
  ];

The javascript example (that it doesn't work):

public isDisabled() {
    return ([parentForm]) => {(parentForm.optimizersSelection.value == 'automatic') ? 'true' : 'false';};
  }

How can I correct the function isDisable() in order to return true if the radio option "automatic" is selected?

Thanks!

Comments (2)

  1. Log in to comment