call a function with BootStrap DateTimePicker(2)
call a function with BootStrap DateTimePicker(2)
Rob Brun
Posts: 56Questions: 2Answers: 14
Hi, I am trying to clear the date Fields in my editor before the create form is displayed. I am using the BootStrap DateTimePicker(2) plugin. I have been trying different variations of this
editor.on('initCreate', function (e) {
editor.field('HireDate').clear();
});
Or
editor.on('initCreate', function (e) {
editor.field('HireDate').val("");
});
So far unsuccessful, I am hoping someone can point me in the right direction.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Ok, I figured out a solution to my situation. I was hoping I could just clear the text field some how, but what I ended up having to do is eliminate the field from the editor and then add it back using the clear method and then the add method for the editor.
I'm surprised that option didn't work. Although perhaps the Bootstrap date time picker doesn't allow for that.
Allan
Hi Allen, The behavior I was getting was the values inside of the Date fields would stick after the editor closed. So when I would go to create a new record after an edit the values from the edit would still be in the date fields. This would only happen for the date fields, the rest of the fields clear on their own like normal. It would also only happen on a create, an edit would replace the value with the value from the record that was being edited.
I was thinking that maybe I had to use the clear() method for the DateTimePicker, I didn't know how to call it though.