tghounsell
Member
I have a js event on the checkbox, firing on "change" to update the value of a jdate field. It does a fine job of displaying the correct date on each state change. No console errors appear. However, even when displaying tne new date, after pressing the form's save button, the previous value of the jdate field flashes in the field and is saved. I'm not sure why or what to do about it.
Here's my JS:
thanks in advance!
Here's my JS:
JavaScript:
var checkbox = Fabrik.getBlock('form_2').elements.get('boats___confirm');
var checkboxValue = checkbox.getValue();
var confirmDateField = Fabrik.getBlock('form_2').elements.get('boats___last_confirmation_date');
var lastDateField = Fabrik.getBlock('form_2').elements.get('boats___previous_confirmation_date_calc');
var lastDateValue = new Date(lastDateField.get('value'));
if(checkboxValue == 1){
var newDate = new Date();
confirmDateField.set(newDate);
}
else{
confirmDateField.set(lastDateValue);
}
thanks in advance!
Last edited: