Can't set check status of CInput('radio') in class.widget.js

XMLWordPrintable

    • Type: Incident report
    • Resolution: False Positive
    • Priority: Trivial
    • None
    • Affects Version/s: None
    • Component/s: None
    • None

      Steps to reproduce:

      1. Adding CInput('radio) in widget.view.php as follows.
        <?php
              // operation mode
              $coolLabel = new CLabel('Cool mode', 'coolLabel');
              $coolRadio = new CInput('radio', 'opMode', 'coolRadio');
              $coolRadio->setId('coolRadio');
              $dryLabel  = new CLabel('Dry mode', 'dryLabel');
              $dryRadio  = new CInput('radio', 'opMode', 'dryRadio');
              $dryRadio->setId('dryRadio');
              $opModeDiv = new CDiv([$coolLabel, $coolRadio, $dryLabel, $dryRadio]);
        
              // widgetView
              $widgetView = new CWidgetView($data);
              $widgetView->addItem($opModeDiv);
              $widgetView->show();
        
      2. Setting check status of dryRadio in class.widget.js as follows.
        class WidgetAirConditioner  extends CWidget {
            onInitialize() {
            }
            
            onResize() {
            }
        
            processUpdateResponse(response) {
                super.processUpdateResponse(response);
            }
            
            promiseReady() {
                return super.promiseReady();
            } 
            
            setContents(response) {
                super.setContents(response);
                const coolRadio = document.getElementsByName("coolRadio"); 
                if (coolRadio) {
                    console.log("coolRadio.checked = true");
                    coolRadio.checked = true;
                }
            }
            
            onClearContents() {
            }
        }
        
      1. "coolRadio.checked = true" log messages has been printed on web browser. But check status of coolRadio is not set.

      Result:

      1. "coolRadio.checked = true" log messages has been printed on web browser. But check status of coolRadio is not set.

      Expected:

      1. "coolRadio.checked = true" log messages has been printed on web browser. And check status of coolRadio is set.

            Assignee:
            Zabbix Support Team
            Reporter:
            snow uyl
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: