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

formatting an auto-populating street address in fillable form

New Here ,
Dec 06, 2022 Dec 06, 2022

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

What script does you use?

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

its seems to only allow javascript

 

AC27466875blg1_0-1670477896183.pngAC27466875blg1_1-1670477918825.png

 

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

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

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

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

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

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;}

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

Or, just use:

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

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