You can define, within a Form Template, several custom buttons to perform custom actions.
Definition of Custom OnClick Actions
To access the script area to define OnClick custom, from the configuration screen of a button, click on the icon </> next to the OnClick label
EXAMPLE 1: Searching for the title of an operation on Google
In the following example we want to implement an OnClick action that searches on google the title of an operation and displays the search results in a new tab.
#retrieve from the current site (ticket) its title $operationTitle = Deep::registry('current_model_instance')->getTitle(); #build the url to search on google $url = "http://www.google.com/search?q=".urlencode($operationTitle); #return the onlclick code of the HTML element return "window.open('$url')";
EXAMPLE 2: Closing an operation and sending reports
In the following example we want to implement an OnClick action that puts an operation in a closed state, and gives the user the possibility to send the report to the applicant, through the email event already configured.