I want to reset my form elements on change
of select box value. The below is the example.
<sj:select
id="uniqueId"
requiredLabel="true"
name="choosenvalue"
list="displayItems"
listKey="key"
listValue="value"
headerKey="-1"
headerValue="Choose displayed Items"
onChangeTopics="change"
href="%{findSelectedValues}"
/>
<sj:spinner
name="spinnner"
id="spinner"
min="1"
step="1"
value="1" />
<sj:datepicker name="datepicker" requiredLabel="true" minDate="0" timepicker="true" />
How to reset the values of datepicker
and spinner
from the values retrieved form the database on change
the select box?
It's easily done via subscribing to the changeTopic
<script type="text/javascript">
$.subscribe("changeTopic", function(event,data) {
$("#formID").resetForm();
});
</script>
where the formID
is an id of the form element. So, in select
tag
onChangeTopics="changeTopic"