Jump to content

Triggering Cascading Dropdown off of Programatically Changed Field


Recommended Posts

Field 1 is a text box.

Field 2 is a cascading dropdown off of Field 1.

Using jQuery .val(), I am successfully updating the contents of Field 1.

The problem is that Field 2 doesn't update it's cascade choices based on the new value in Field 1.  

It all works when I manually change Field 1 and the jQuery code is successfully putting the value in Field 1.

I'm not sure where my issue is occurring.

Thanks!

Link to comment
Share on other sites

  • 3 years later...

Hi Casey!

Not sure if this is still relevant, but I also tried to find a solution to similar case.

The thing is, when setting value of the text field programmatically, it does not trigger event "Change", so to work around this, we need to trigger this event with script.
So overall it will look like this:
 

const textField1 = document.querySelector('[id*=InsertRecordTextField]');
textField1.value = 'Somevalue';
textField1.dispatchEvent(new Event('change', { 'bubbles': true }))


Hope this helps
 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...