Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
2022-06-23 08:07 AM
I have a requirement where user should get warning message whenever he enters an email ID which is not as per our company's domain.For example:- A company has email address ending with @abc.com and if user enters any other address,he should get pop-up message or on save that this ID is not allowed.
Anybody has any code which relates to this requirement. @DavidPetty @Ilya
2022-06-23 09:22 AM
2022-06-24 05:48 AM
I want to stop a user from entering an non-organizational email address by validating its domain like @abc.com.If it is not @abc.com,warning message should appear. Any custom object available for it. @Anonymous
2022-06-24 06:44 AM - edited 2022-06-24 06:53 AM
Yes, and that is exactly regexp I provided in the 1st post. You just need to change and provide your regexp and field id to the one of custom object examples.
2022-07-01 06:31 AM
Hi,
I created this custom object by referring your 1st post .Warning message is appearing when user is enter non-domain email address but still user is able to save or save and close the record. How to give warning on save or save and close as well. Any code reference for the same. @Anonymous @DavidPetty Below is the code which I created
Custom Code to stop entering Non-Domain email address in certificate request application
<script type="text/javascript">
function pageLoad() {
// Using the .focusout event causes the warning to display only once.
$('input[id*="f23172c"]').focusout(function() { IsEmailValid("f23172c", $(this).val()); });
$('input[id*="f23173c"]').focusout(function() { IsEmailValid("f23173c", $(this).val()); });
$('input[id*="f23171c"]').focusout(function() { IsEmailValid("f23171c", $(this).val()); });
$('input[id*="f23169c"]').focusout(function() { IsEmailValid("f23169c", $(this).val()); });
$('input[id*="f24115c"]').focusout(function() { IsEmailValid("f24115c", $(this).val()); });
$('input[id*="f24116c"]').focusout(function() { IsEmailValid("f24116c", $(this).val()); });
$('input[id*="f24112c"]').focusout(function() { IsEmailValid("f24112c", $(this).val()); });
$('input[id*="f24114c"]').focusout(function() { IsEmailValid("f24114c", $(this).val()); });
// Using the .change event causes the warning to display twice.
//$('input[id*="f23172c"]').focusout(function() { IsEmailValid("f23172c", $(this).val()); });
//$('input[id*="f23173c"]').focusout(function() { IsEmailValid("f23173c", $(this).val()); });
//$('input[id*="f23171c"]').focusout(function() { IsEmailValid("f23171c", $(this).val()); });
//$('input[id*="f23169c"]').focusout(function() { IsEmailValid("f23169c", $(this).val()); });
//$('input[id*="f24115c"]').focusout(function() { IsEmailValid("f24115c", $(this).val()); });
//$('input[id*="f24116c"]').focusout(function() { IsEmailValid("f24116c", $(this).val()); });
//$('input[id*="f24112c"]').focusout(function() { IsEmailValid("f24112c", $(this).val()); });
//$('input[id*="f24114c"]').focusout(function() { IsEmailValid("f24114c", $(this).val()); });
}
function IsEmailValid(field, str){
var myRegExp = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@(pwc.com)$/;
if(myRegExp.test(str) != true && str != "") {
setTextField(field, "");
WarningAlert('The field must contain RIL domain email address only. Bad value: ' + str, 'Warning');
}
}
function setTextField(f,v) {
var textFieldAttributes = new Array();
textFieldAttributes.push({
enabled: true,
emptyMessage: '',
validationText: v,
valueAsString: v,
lastSetTextBoxValue: v});
var textFieldAttributesSerialised = Sys.Serialization.JavaScriptSerializer.serialize(textFieldAttributes[0]);
$('input[id$="'+ f +'c"]').val(v);
$('input[id$="'+ f +'c_ClientState"]').val(textFieldAttributesSerialised);
}
</script>
2022-07-01 07:03 AM
You need to override handler for save buttons. Look at @DavidPetty code in here for hijacking save buttons: