Hello, we are upgrading SharePoint 2013 to SharePoint 2016 and have a form with some custom javascript in it. On Nintex Forms 2013 version all works well, but when using the same js on 2016 this does not work?
I have a dropdown on the form with the client id stored in a js variable. The var name is myCompanyDropdown.
this line of code sets the dropdown to a specific value, eg TEST:
NWF$("#" + myCompanyDropdown + " option:contains(TEST)").attr("selected", true);
But, when i try the same on the SP2016 version, this does not work?
It returns the object:
{
[functions]: ,
context: { },
jquery: "1.10.1",
length: 0,
prevObject: { },
selector: "#ctl00_ctl40_g_8a1e4ee4_92ec_4600_9262_776710cee826_ctl00_ListForm2_formFiller_FormView_ctl30_ecb50df3_9df4_48e9_8e38_2091e83d368a_hid option:contains(TEST)"
}
i found out that when i run this code: console.log(myCompanyDropdown);
it returns this
ctl00_ctl40_g_8a1e4ee4_92ec_4600_9262_776710cee826_ctl00_ListForm2_formFiller_FormView_ctl30_ecb50df3_9df4_48e9_8e38_2091e83d368a_hid
what at the end the _hid, so is this a hidden field? And indeed, when i inspect element the Dropdown, the id is different, eg:
ctl00_ctl40_g_8a1e4ee4_92ec_4600_9262_776710cee826_ctl00_ListForm2_formFiller_FormView_ctl30_ecb50df3_9df4_48e9_8e38_2091e83d368a
and if i change the option:contains to this id, it works??
NWF$("#ctl00_ctl40_g_8a1e4ee4_92ec_4600_9262_776710cee826_ctl00_ListForm2_formFiller_FormView_ctl30_98acc963_979e_425d_bebb_fa102b6b6993 option:contains(TEST)").attr("selected", true);
so, why doesn't NWF$("#" + myCompanyDropdown) work on SP2016 and gives me a hidden field instead of the actual dropdown?