Use the following function in onclient click
.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
function IsEmptyPeoplePicker(pickerClientId) {
var r = false;
try {
var txt = pickerClientId.text(); //Enter Name or Email Address...Rajesh Sivaprasadx
//If their is a selection in picker, always last character is 'x'.
//If last index of 'x' and total lenth is same,means picker has a resolved entity.
if (txt.lastIndexOf("x") != (txt.length - 1)) { return r = true; }
} catch (e) {return r = true; }
return r;
}
''''''''''''''''''''''''''''''''''''''
It will return true if the picker empty.
Use a div with class me-error just below client picker in the same <td> to show validation message
eg: var isEmptyUserPicker = IsEmptyPeoplePicker($('#<%=userPicker.ClientID%>'));
if (isEmptyUserPicker) {
$("#divUserPickerValidator").text("Please select Recommender");
$("#divUserPickerValidator").show();
$("#divUserPickerValidator").fadeOut(5000);
return r = false;
}
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
function IsEmptyPeoplePicker(pickerClientId) {
var r = false;
try {
var txt = pickerClientId.text(); //Enter Name or Email Address...Rajesh Sivaprasadx
//If their is a selection in picker, always last character is 'x'.
//If last index of 'x' and total lenth is same,means picker has a resolved entity.
if (txt.lastIndexOf("x") != (txt.length - 1)) { return r = true; }
} catch (e) {return r = true; }
return r;
}
''''''''''''''''''''''''''''''''''''''
It will return true if the picker empty.
Use a div with class me-error just below client picker in the same <td> to show validation message
eg: var isEmptyUserPicker = IsEmptyPeoplePicker($('#<%=userPicker.ClientID%>'));
if (isEmptyUserPicker) {
$("#divUserPickerValidator").text("Please select Recommender");
$("#divUserPickerValidator").show();
$("#divUserPickerValidator").fadeOut(5000);
return r = false;
}
No comments:
Post a Comment