In Rollbase, for Record New/Edit/Status-Change/QuickCreate pages, user can configure 'onsbumit' event handler in
Object Definition -> Pages -> Edit Page -> Properties -> HTML Event Handlers section.
Additionally, with New UI (4.0.4) release, we have added client-side API options to acheive the same. Users can now also configure a script component on the page & leverage this API to attach form submit handlers.
Given below is a code snippet that demonstrates the same:
<script> } </script> |
Note: Directly attaching form submit handlers on <form> elements or 'click' event handlers on Submit button in page is discouraged. This may interfere with Rollbase platform behavior & also have compatibility issues across releases. Additionally, handlers configured in this manner may also be incorrectly notified on form cancel.
I'm having a bit of trouble with this -- I have a function in the Object > Page Properties > HTML Event Handlers > onsubmit() field. This function is getting triggered when the user presses "Cancel" and "Save." How do I prevent the function from being executed when the user presses "Cancel"?
Here's the function in onsubmit:
savePickUp(function() {
rbf_growlInfo("Testing", "onsubmit triggered");
});
where "savePickUp" is a function defined in a custom script on the page.
Yes, there is an issue here. Ideally form submit handlers should not be notified on form cancel.
We will resolve this in a forthcoming release. For a workaround, can you please review the following thread:
https://community.progress.com/community_groups/rollbase/f/25/t/21673