Changes

Onloadfunc

1,293 bytes added, 18:51, 30 April 2013
no edit summary
}
===Important===
* There can only be one '''onloadfunc''' on the page. If there are multiple onloadfunc functions defined the system will only run one of them.
If you have an '''onloadfunc''' on multiple different User [[Role]]s then if a contact happens to have 2 roles that both have a Custom Field with '''onloadfunc''' defined you will run into this issue.
This can be avoided by creating an [[Browser Script]] Custom Field that is visible for all contacts using the '''User Custom Fields''' and/or '''Contact Custom Fields''' on [[Global Settings]. That [[Browser Script]] custom field can have the '''onloadfunc''' that will be visible for all users, that will look for other functions defined on various roles to be called:
 
 
<pre>
function onloadfunc{}(
if(window.employeeOnloadfunc) //check if there is a function on the page called employeeOnloadfunc
employeeOnloadfunc(); //call the function if present.
if(window.applicantOnloadfunc) //check if there is a function on the page called applicantOnloadfunc
applicantOnloadfunc(); //call the function if present.
}
</pre>
 
The on the employee role and applicant role create [[Browser Script]] fields with those functions. They will be called in turn by the main onloadfunc that the system calls automatically.
0
edits