Set dropdown value in javascript

0
I'm trying to provide a shortcut to the user in the form of a javascript button which will automatically set the value of a dropdown (reference selector) to save the user scrolling through the dropdown items to find the right one. I am able to see the value being set visually, but when the form gets posted it fails validation saying no value has been selected. Can someone tell me what I need to tell dojo/dijit in order to correctly set the value of the dropdown? html: <select class="form-control"><option value=""></option><option value="32932572275232153">07:00</option><option value="32932572275232154">07:15</option><option value="32932572275232155">07:30</option> .. etc .. </select> javascript (have tried jquery and dijit): dijit.byId( 'mxui_widget_ReferenceSelector_0' ).set( 'value', String( 32932572275232153 ) ); $('.mx-name-timeFrom option:contains(07:00)').prop("selected", true); The dijit statement doesn't do anything, and the jquery one does appear to set the value correctly, but then doesn't actually work when submitting the form
asked
3 answers
0

Why would you do this in Java script, and not in, e.g., an OnChange miroflow, or when opening the screen?

answered
0

Hi Richard,

Have a look over here http://stackoverflow.com/questions/78932/how-do-i-programatically-set-the-value-of-a-select-box-element-using-javascript

answered
0

This is just a guess, but here goes:

I think you need to to use the ID of the referencing object. You can't use a normal String value which you create yourself. The reference selector is a reference to another entity, so you need to map it to a Database Object, and use the ID of the correct database record.

How and IF this is even possible, I have no idea. I agree with Rom in that you should use the platform itself to handle things like this

answered