How to avoid Dropdown onChange event firing when the lookup values are populated programmatically

  • 3 April 2017
  • 5 replies
  • 36 views

Badge +4

Hello

I have attached my javascript code below. I am not sure how to enforce the onchange event to be called only when the user selects the drop down value.

I have a cascading dropdown set - Noun and Noun modifier. When the list is being populated my onChange event is called and in my repeating section I have repeated rows when on Edit Mode. 

I tried the NWF.FormFiller.Events.RegisterAfterReady with pollSP = setInterval(checkSPLoad, 500);  but then my dropdowns are not even loading.

When I use the developer's tools I dont see any errors.

I am new to Nintex forms and any help is greatly appreciated.

Thanks

Kalpana


5 replies

Badge +8

Can you please share a screenshot of your Nintex form for more clarity?

Badge +4

Thank you for taking the time to look at my issue: I have attached the two cascading dropdowns

After I select Noun - my noun modifiers get populated and when I select the noun modifier my repeating section will display the rows based on the REST API call in GetCharacteristics. 

I want this method to be called only for user onchange event. 

Currently when the form is loading for each dropdown option change from undefined to actual value, this method is called.

Badge +8

This is what I understand:

  1. Noun is a Choice control and NounModifier is a ListLookup control
  2. Based on Noun selection NounModifier option is populated
  3. Based on NounModifier selection the RepeatingSection data is populated by making a REST API call GetCharacteristics

Issue: GetCharacteristics method is called on form load / When data is populated in NounModifier ListLookup control also GetCharacteristics is getting called?

A suggestion is to check for below points:

  1. In the script ready is not set to false, it seems to be true all time
  2. When data is populated in NounModifier ListLookup control, check if Noun is not set to default value

201466_pastedImage_2.png

Badge +4

Thanks for working with me on this.

I have the variable set to false at the start: I am mainly using it to make sure that my scripts are getting loaded for my REST API call.

var SPHostUrl;
var SPAppWebUrl;
var ready = false;

I will try the solution you gave me : where Noun Modifier is not empty, but would also have to check that the original value is not changed.

Is there no onSelectedIndexChanged event?

Badge +4

So this is what I did: Please let me know if the work around is ok

Added a text box and set its value to the option selected and then in my getCharacteristics method I check the textbox(previous) value to the current value of the dropdown before running the code.

Thanks for your support!

Reply