Preset Cascading Value from JS on Form Load
- This topic has 2 replies, 2 voices, and was last updated 10 years, 5 months ago by .
Viewing 2 reply threads
Viewing 2 reply threads
- You must be logged in to reply to this topic.
Home › Forums › Cascading dropdowns › Preset Cascading Value from JS on Form Load
Hello Alexander,
I hope you can help, I want to set a start value in a cascading dropdown field from JS. I’ve tried using setFieldValue(‘Product’,_lclProduct); where ‘Product’ is the cascading field, (SPFieldText) and _lclProduct is the initial value I want to set the field to. The cascading field works fine from user input, but trying to set it from JS does not populate the value into the Product field. How can I best do this?
Thank you in advance.
Ian
Alexander, I’ve read other items in the forum now that suggest this approach won’t work. I’ve used an alternative solution that seems to work Ok for me. I prefill the text fields using SPServices then open the list item this prepopulates the Cascade field as I want and all seems to work fine.
Thanks
Ian
Hi,
You should be able to use setFieldValue to set the field – which version of the cascading dropdown plugin are you using? – this might be a problem with an older version.
In your example – is _lclProduct a variable? – if not, you must use quotes like this:
setFieldValue("Product","_lclProduct");