Cascading Lookup Fails When Criteria Is Set Using Javascript

  • 28 January 2017
  • 6 replies
  • 0 views

Badge +3

Thank you in advance for any help you can offer.  Here is a description of the problem.

A List Lookup control has the following properties

197987_pastedImage_2.png

And it has these filter-by values

- Control: 'sltCompany'
- Column: 'lpCompanySpecific'

197988_pastedImage_3.png

Positive test works as expected...

- filter value = results

197990_pastedImage_5.png

Negative test works as expected…

- no filter value = no results

197989_pastedImage_4.png
…until I start setting the control value programatically using Javascript197991_pastedImage_6.png

After function set the control value,

no results are returned.

Even manually retyping the filter value,

the filter no longer works

197992_pastedImage_7.png

Reload the form,

manually type the filter value,

and the filter works again.

197993_pastedImage_8.png
Then execute the Javascript to override the typed control value...197994_pastedImage_11.png

...and again the filter no longer works,

even manually retyping the value,

no results

197995_pastedImage_12.png
Normal Javascript, nothing extravagant

197996_pastedImage_13.png

197997_pastedImage_14.png

197998_pastedImage_16.png


6 replies

Userlevel 6
Badge +15

Hi Neville Scheevel‌ !

I think this might solve your issue:    

Let me know if it works out!

Cheers,

Rhia

Badge +3

I updated by code to this...

function SetCtrlValue () {
NWF$ ( '#' + ctrlCompany ).val( 'ABC Company' )
var ctrl = NWF$ ( '#' + ctrlCompany )
NWF.FormFiller.Functions.ProcessOnChange( ctrlCompany );
}

...and it produces the following Javascript error

198002_pastedImage_1.png

Userlevel 6
Badge +15

Hmm interesting! And this is On-Prem not O365, right?

Badge +3

Correct, 2013 on-prem.

Userlevel 6
Badge +15

I think I got it!

function SetCtrlValue () {
NWF$ ( '#' + ctrlCompany ).val( 'ABC Company').trigger('change');
 }

Try this out happy.png This worked for me in my trials.

Cheers,

Rhia

Badge +3

Brilliant! That fixed it! Thanks so much!

Reply