Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
0

Form Field which only allows a normal space

New Here ,
Jul 18, 2022 Jul 18, 2022

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
513
Translate
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
1 ACCEPTED SOLUTION
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.

View solution in original post

Translate
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
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.

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

Translate
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