Skip to main content

Presave

You can enter your own script when you press the "Save" button in EditView mode. To register a script use the method:

SDK::setPreSave($module, $src);

$module : the name of the module
$src : the path of php file

To remove the customization:

SDK::unsetPreSave($module, $src = NULL);

$module : the name of the module
$src : the path of php file (if NULL, includes all scripts registered for that module)

The following variables are available within the script:

$type : the form name (“MassEditSave”, “DetailView”, “EditView”, “createTODO”, “QcEditView”, “ConvertLead”, “createQuickTODO”, “Kanban”)
$values : (array) new values
$values['massedit_recordids'] : (string, only for MassEdit) the ids to edit, separated by “;”

In the case of createQuickTODO the fields available in $values are as follows:

EventsTasks
Module => 'Calendar',CalendarTitle, CalendarStartTime, CalendarEndTime, IsAllDayEvent, timezone, EventType, Description, LocationModule = 'Calendar',
activity_mode => Task,hour, day, month, year, task_time_start, task_subject, task_description, taskstatus, taskpriority, task_assigntype, task_assigned_user_id, task_assigned_group_id, starthr, startmin, startfmt, task_date_start, task_due_date

The following variables can be set:

$status : (bool) whether or not the submit should be saved
$message: (string) if not empty a popup with the message is shown
$confirm: (bool) if true, a Javascript popup is shown asking for confirmation to continue, showing $message. In this case, $status must not be set.
$focus : (string) in case of error, the element that takes the focus (only if $status = false)
$changes: (array) values to assign to the fields (only if $status = false)

The $focus and $changes variables are only available when $status is false and $type is one of 'EditView', 'createTodo', 'QcEditView', 'ConvertLead'.

Hooks
include/js/general.js
include/js/KanbanView.js
modules/Calendar/script.js
modules/Calendar/wdCalendar/sample.php
modules/Leads/Leads.js
modules/Users/Forms.php
modules/VteCore/KanbanAjax.php
Smarty/templates/Header.tpl
Smarty/templates/ComposeEmail.tpl
Smarty/templates/Popup.tpl