ReferenceError: PasswordValidator is not defined.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2024 11:10 PM - edited ‎10-23-2024 01:38 AM
Test
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2024 11:35 PM
Hello ,
Please try below code as we are in client sript we must have to call the script via the glideAjax
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}
var ga = new GlideAjax('PasswordValidator');
ga.addParam('sysparm_name', 'validatePassword'); // Call the validate method in Script Include
ga.addParam('password', newValue); // Pass the new password value to the script include
ga.getXMLAnswer(function(response) {
var result = JSON.parse(response); // Parse the JSON string returned by Script Include
if (!result.isValid) {
var errorMsg = "Password validation failed:\n" + result.errors.join("\n");
alert(errorMsg);
g_form.setValue('password', '');
control.setError(errorMsg); // Optionally set an error on the field
}
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2024 11:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2024 02:13 AM
Hello ,
I got why it's happening some time we have done some mistakes in configuring the variables so please check if there is any client script or UI policy is conflicting at that time we are facing this type of issue I also observed this type of issue, so please check catalogue item configurations like variable, variable set, client script, or UI policy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2024 02:14 AM
Also please remove the logs from the client script