Accessing JADE attribute from JavaScript function

For questions and postings not covered by the other forums
LAshikoto
Posts: 1
Joined: Fri Feb 12, 2016 1:49 am

Accessing JADE attribute from JavaScript function

Postby LAshikoto » Fri Feb 12, 2016 5:18 pm

Hi

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:

StaffCareWeb::WunitSchedules::setupScript
-This method contains the JS with the function checkSaveVersion (line26 – 51)

StaffCareWeb::WunitSchedules::btnSave_click()
-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.

StaffCareWeb::WunitSchedules:: handleSave()
-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?

Regards

Leonard
Attachments
WUnitSchedules_setupScript.mth
(2.75 KiB) Downloaded 210 times
WUnitSchedules_handleSave.mth
(2.94 KiB) Downloaded 199 times
WUnitSchedules_btnSave_click.mth
(781 Bytes) Downloaded 204 times

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 9 guests

cron