mg2017
06/03/2020, 3:20 PMTyler
06/03/2020, 3:21 PMmg2017
06/03/2020, 3:38 PMTyler
06/03/2020, 3:39 PMMTNathan
06/03/2020, 3:45 PMreturn false;
on validateField is a defect (I know for sure it hasn't always acted like that) but I've been fighting support on and off for years to get them to admit it/do something about it and have, so far, come up empty handed. I'm not really sure of the purpose of validateField separate from fieldChanged if you can't return false;
without issues.MTNathan
06/03/2020, 3:46 PMMTNathan
06/03/2020, 3:48 PMif ( validation === false ) {
alert('Message to the user');
var fieldObject = document.getElementById(fieldID);
var fieldOnBlur = fieldObject.onblur;
fieldObject.onblur = function () {};
setTimeout(function() {
fieldObject.focus();
fieldObject.onblur = fieldOnBlur;
},50);
return false;
}
mg2017
06/03/2020, 3:53 PMmg2017
06/03/2020, 3:53 PMMTNathan
06/03/2020, 3:58 PMmg2017
06/03/2020, 10:23 PMMTNathan
06/04/2020, 1:58 PMvar fieldObject = document.getElementById('custpage_field_id');
or, if you're using this on multiple fields and want to create a loop or reusable function, you could use a variable like:
var fieldID = 'custpage_field_id';
var fieldObject = document.getElementById(fieldID);
mg2017
06/05/2020, 12:20 PMMTNathan
06/05/2020, 1:58 PMdocument.getElementById('custrecord_item_name');
to work (you could probably just as easily pass in context.fieldId
as a variable, especially if you want the code to be reusable), and if it's not throwing the 'can't find property' error I'd say that's a good sign. What does the rest of your code look like? Appearing like it's not doing anything might actually mean it's working, depending on what else your function's trying to do.mg2017
06/05/2020, 7:55 PMmg2017
06/05/2020, 7:55 PMMTNathan
06/05/2020, 9:16 PMcustrecord_item_name
field to a blank string before returning false (and then skip the whole onblur
workaround). It's definitely not as good of a user experience, but it's at least functional if the repeating popups are preventing you from deploying this code.mg2017
06/05/2020, 10:33 PM