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

formatting an auto-populating street address in fillable form

New Here ,
Dec 06, 2022 Dec 06, 2022

Copy link to clipboard

Copied

I have a form where the addresses auto-populate as a single line like:

1234 Main St., City, ST 123456789

and I want it to show up like

1234 Main St.
City, ST 12345-6789

If I cant break the line between street and city, is it possible to at least add a - in the zip?  Any help with the custom formatting javascript would be greatly appreciated.

TOPICS
JavaScript , PDF forms

Views

1.4K

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
Community Expert ,
Dec 07, 2022 Dec 07, 2022

Copy link to clipboard

Copied

What script does you use?

Votes

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 ,
Dec 07, 2022 Dec 07, 2022

Copy link to clipboard

Copied

its seems to only allow javascript

 

AC27466875blg1_0-1670477896183.pngAC27466875blg1_1-1670477918825.png

 

Votes

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
Community Expert ,
Dec 07, 2022 Dec 07, 2022

Copy link to clipboard

Copied

How do you populate address? You can use \n to break a line in script.

Votes

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 ,
Dec 07, 2022 Dec 07, 2022

Copy link to clipboard

Copied

we upload these fillable forms to our medical record system with pre-defined form fields and when we load the form for a patient it autopopulates the fields.  i dont have control over how the text is received into the form but if there can be some processing in the pdf on receipt of the text, we could hopefully make it behave the way we want

Votes

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
Community Expert ,
Dec 08, 2022 Dec 08, 2022

Copy link to clipboard

Copied

Set field as 'Multiline' in field properties under options tab, and put this in that field under 'Validate' tab at 'Run custom validation script':

if(event.value){
var str = event.value;
var address = str.slice(0, str.indexOf(","));
var city = str.slice(str.indexOf(",") + 2);
event.value = address+"\n"+city;}

Votes

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
Community Expert ,
Dec 08, 2022 Dec 08, 2022

Copy link to clipboard

Copied

LATEST

Or, just use:

event.value = event.value.replace(", ", "\n");

Votes

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