-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContactScripts.js
50 lines (35 loc) · 1.5 KB
/
ContactScripts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// JavaScript source code
function ContactLoad(executionContext) {
//get Form Context
var formContext = executionContext.getFormContext();
//get Attribute Data
var firstName = formContext.getAttribute("firstname").getValue();
//set attrbute
formContext.getAttribute("description").setValue("The FirstName is " + firstName);
}
function OnEmailChange(executionContext) {
//get formContext
var formContext = executionContext.getFormContext();
//validate email
var emailAddress = formContext.getAttribute("emailaddress1").getValue();
if (emailAddress == '') {
formContext.getControl('emailaddress1').setNotification('You have changed email', 'email_id');
}
else {
formContext.getControl('emailaddress1').clearNotification('email_id');
}
}
function ONSSNChange(executionContext) {
//get formContext
var formContext = executionContext.getFormContext();
//validate email
var SSN = formContext.getAttribute("pru_socialsecuritynumber").getValue();
if (isNaN(SSN) || SSN.length > 5) {
formContext.getControl('pru_socialsecuritynumber').setNotification('Please enter valid SSN Number less than 11 digits', 'ssn_id');
formContext.ui.setFormNotification('Incorrect Data', 'WARNING', 'formmsg');
}
else {
formContext.getControl('pru_socialsecuritynumber').clearNotification('ssn_id');
formContext.ui.clearFormNotification('formmsg');
}
}