Skip to Content
Menu
This question has been flagged
1131 Views

Hello,


I have a form in which the user is setting up an event start time and event end time.  I calculate the DURATION of the event, and ONLY if the event is over a certain duration threshold, I want to prompt the user for confirmation.  If it is below the threshold, I want the form to submit without prompting.


I've tried many things but can't seem to get it to work. 


One Idea I had was to use a hidden field called "duration_ok", which defaults to False. In my @api.constrains method that checks the form values,

    If the duration is below limit, it sets "duration_ok" to True

    Then, if "duration_ok" is still set to False,I raise a UserError telling the person to submit again to confirm. Then I set the "duration_ok" to True, so the next time they submit it will be accepted.


But in practice, it does not work.


Any help appreciated, thanks!!!

Avatar
Discard