Profile Field Events Tab
Here you need to enter the client side JavaScript you want to execute before or after the related field and its related event gets executed on the client side. You can use PaperSave Profile Fields using the \"profile\" object followed by a \".\" and the field name (use \"_\" for spaces if your field has spaces).
Example: profile.Invoice_Amount (for a profile field called \"Invoice Amount\"). Remember that all object names are case sensitive. You can test the script by providing test values in the Profile Input section on the left and then by clicking on the Test Script button. Output profile values will be displayed in the Profile Output section on the right. You can view the output XML by clicking on the View Output button. Click here to get the list of PaperSave Variables that can be used while executing script.
To enter the client side JavaScript into the Profile Field, click Profile Field Events tab.
By clicking the Edit Script buttons, client side JavaScript can be added, such as validations or alerts, with the following Events:
• | OnEnter Event: when the Profile Field is selected. |
• | OnChange Event: when the Profile Field value is changed. |
Note: |
Please take a note that script execution for OnChange Event is NOT possible for Table Type Profile Field if the script's condition fills the table data. |
• | OnExit Event: when the Profile Field is exited. |
When you use profile.Field_Name in the Lookup query it will replace the value with quotes. If you want to use the value for the table name or column name only without changing the quotes, then you must use square brackets such as [profile.Field_Name]. This feature also supports number and date conversion for SQL queries.
□ | Generating Custom Error Message from Script Editor: |
PaperSave gives you the ability to generate custom error message by writing a script in script editor window in below given format:
throw new Error("<message text>")
You can write the script as given in below example:
try{
if(<condition if true>)
throw new Error(<"My Exception Message">);
}
catch(e)
{
throw (e.message);
}
Tip: Press F1 to open the current function with the User Guide.
For more examples, see PaperSave JavaScript library functions.