AnsweredAssumed Answered

How to I get the onchange event to work?

Question asked by obylium on Feb 16, 2015
Latest reply on Jun 11, 2018 by guyo

Should be pretty straight forward, but I am still having difficulties.  Basically I want to create drop down items from a list based off another drop down's selections.  I want to call the list lookup function after the value of the main drop down gets changed.   As for my problem, I am trying to implement an onchange event to my main drop down control.  When I change the drop down control, it still doesn't log anything to the console.  Even if the superVisor variable was blank, it would still log an empty value.

 

I made sure that in the settings for the drop down, I set the "Store Client ID in JavaScript variable" to Yes and put the name as "ddlTitle". Yet, for some reason, this still isn't working.  Am I doing the syntax right?  For regular HTML objects, this works just fine.

 

 

NWF$(document).ready(function() {
    var superVisor = NWF$('#' + ddlSuper).val();
    NWF$('#' + ddlTitle).onchange = function() {valueChanged()};
 });

 function valueChanged() {
  console.log(superVisor);
 }

Outcomes