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.
Copy link to clipboard
Copied
What script does you use?
Copy link to clipboard
Copied
its seems to only allow javascript
Copy link to clipboard
Copied
How do you populate address? You can use \n to break a line in script.
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
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;}
Copy link to clipboard
Copied
Or, just use:
event.value = event.value.replace(", ", "\n");