I have a button (StaffCareWeb::WunitSchedules::btnSave) that once clicked it saves the rota. However, before the JADE save method (handleSave) is called, there is a JS function checkSaveVersion that is first called and is linked to btnSave, onClick function. In this JS function, it checks whether the version of the rota is 0. In the case that it is, it displays a warning message and the user can either click “OK” to proceed saving or “CANCEL” to abort the save process.
In the JADE class StaffCareWeb::WunitSchedules I have created a Boolean attribute allowSave. I would then like to set this attribute from the JS function, depending on the button that is clicked. If the “OK” button is clicked, it should set the value to true, if “CANCEL” is clicked, it should set it to false. Once this attribute has been set from the JS function, the method StaffCareWeb::WunitSchedules::btnSave_click() will then check whether it should call the StaffCareWeb::WunitSchedules:: handleSave() method or not.
I have attached the following methods:
-This method contains the JS with the function checkSaveVersion (line26 – 51)
-This method is the one called after the JS function has been executed. It is the one where the allowSave attribute is checked to see whether the save should be performed or not.
-This is the method that performs the saving process.
Could you please assist me in how to set the value of allowSave to either TRUE or FALSE from within the checkSaveVersion JS function?