Copy link to clipboard
Copied
Is there any way for a form field to only accept a normal default space. I need it to weed out all thin spaces like 1/8, 1/4, 1/2 etc. and change to full space. Another possible solution would be for an error to pop up if that field contains a thin space for user to correct. I'm using Adobe Acrobat DC. Thanks!
You can do it using this code as the field's custom Validation script to replace all Thin Space characters (U+2009) with a regular space:
event.value = event.value.replace(/\u2009/g, " ");
Duplicate the .replace(...) part for each unicode character you want to do it to, adjusting the unicode code value each time, of course.
Copy link to clipboard
Copied
You can do it using this code as the field's custom Validation script to replace all Thin Space characters (U+2009) with a regular space:
event.value = event.value.replace(/\u2009/g, " ");
Duplicate the .replace(...) part for each unicode character you want to do it to, adjusting the unicode code value each time, of course.
Copy link to clipboard
Copied
try67, the custom validation script you helped me write below works perfect. Thanks!!!!
event.value = event.value.replace(/[\u2008\u202f\u205f\u3000\u2000\u2001\u2002\u2003\u2009\u2004\u2005\u2006\u2007\u200A]/g, " ");