• Binary
    February 19, 2020 at 1:43 am #5681

    Hi all,

    I’m not a front end developer. My code works but I’m not sure, if this is the most efficient way to do it.

    var healthMonitoringTyp = page.ui.get("/Auftragsdaten/healthMonitoringTyp");
    var healthmonitoringport = page.ui.get("/Auftragsdaten/healthmonitoringport");
    var healthmonitoringuri = page.ui.get("/Auftragsdaten/healthmonitoringuri");
    var healthmonitoringgueltigeantwort = page.ui.get("/Auftragsdaten/healthmonitoringgueltigeantwort");
    
    if (healthMonitoringTyp.getSelectedItem() == "tcpHandshake" ) {
    	healthmonitoringport.show();
    } else {
    	healthmonitoringport.setVisible(false, true);
    }
    
    if (healthMonitoringTyp.getSelectedItem() == "http" ) {
    	healthmonitoringuri.show();
    	healthmonitoringgueltigeantwort.show();
    	
    } else {
    	healthmonitoringgueltigeantwort.setVisible(false, true);
    	healthmonitoringuri.setVisible(false, true);
    }

    Isn’t there a way to change the focus, so I could use ${healthmonitoringuri} instead of defining a variable for each element?

    SPARK Support
    February 24, 2020 at 11:30 am #5685

    Hi Binary,

    The ${ControlName} notation only works from the inline event handlers in the controls.  If your script is defined on a custom Coach View, you may want to try changing your code to this.ui.get(“controlName”).  However, you will still need to use variables to reference the controls, which is actually best practice if you execute multiple statements against the controls.

    Regards,

    Stephen P.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Start typing and press Enter to search