How can I call the set() event from the onChange() event without requiring the user to click the SET button. I am looking at how to do this on the date component but other components aswell. Using HTML form fields, I want, for example the selected date, to be written to the form field as soon as selected without the need for the user to press “Set”.
I also want to be able to revert to the original value that was in the field when cancel is clicked (but thats my next challenge)…
1 Like
Sort of figured this out, at least at a simple level:
onShow: function (event, inst) {
console.log('onShow');
inst.lf_orgValue = $(inst.element).val();
}
,
onChange: function (event, inst) {
var curVal = inst.getVal(true);
$(inst.element).val(event.valueText);
inst.lf_didSetOnChange=true;
}
,
onCancel: function (event, inst) {
if (inst.lf_didSetOnChange){
$(inst.element).val(inst.lf_orgValue)
}
}
Ha! Reading further, I found that setting the options > buttons to NOT include a set button forces this automatically:
uttons to display. Each item in the array will be a button. A button can be specified as a string, or as a button object.
When the passed array does not contain the predefined 'set'
button, the auto-selection will be turned on. Selecting a value on the UI this way, will be set to the input immediately. If there are more than one wheels shown, the control will close on overlay tap. Otherwise tapping a value on the wheel will also close the control.
1 Like