Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Removing certain string characters from field entry

Explorer ,
May 29, 2017 May 29, 2017

Is there a script to remove characters from a field entry if one is entered, like a comma?

Thanks.

TOPICS
Acrobat SDK and JavaScript , Windows
1.9K
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

correct answers 1 Correct answer

Community Expert , May 29, 2017 May 29, 2017

Sure. You can use this script as a custom validation script to do that:

event.value = event.value.replace(/,/g, "");

Translate
Community Expert ,
May 29, 2017 May 29, 2017

Sure. You can use this script as a custom validation script to do that:

event.value = event.value.replace(/,/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
Explorer ,
May 29, 2017 May 29, 2017

Thank you, excellent.

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 ,
Apr 17, 2024 Apr 17, 2024

This script works well for removing commas, but what if I want to remove the / from a date entry.

e.g: 2024/04/17 to become 20240417.

 

Thanks in advance!

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 ,
Apr 17, 2024 Apr 17, 2024

Use this code to remove all non-digits:

event.value = event.value.replace(/\D/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
New Here ,
Apr 17, 2024 Apr 17, 2024
LATEST

Thank you so much!

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