Form Field which only allows a normal space

New Here ,
Jul 18, 2022 Jul 18, 2022

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!

TOPICS
Create PDFs , Edit and convert PDFs , How to , PDF forms

Views

37

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 18, 2022 Jul 18, 2022

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.

Likes

Translate

Translate
Community Expert ,
Jul 18, 2022 Jul 18, 2022

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 18, 2022 Jul 18, 2022

Copy link to clipboard

Copied

LATEST

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, " ");

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines