I have 2 date fields (from_date, to_date) in django admin site for a model. Whenever the value of ‘from_date’ changed, I need to add from_date + 10 more days to the to_date field. I have used change() event of the from_date text box. The problem is that When I choose the date from Date Widget, this change() is not getting called. Any suggestions to deduct this change?
Share
The reason the change event is not fired is because the value is changed programmatically instead of by the user, after which the input field recieves focus. Upon losing focus, the input field detects no changes, as the value is not changed during the time the widget was focussed.
I would suggest using the onBlur() event listener of the TextInput to change the to_date field, which is fired as soon as a input widget loses focus: