Select to view content in your preferred language

& character in field name breaking url

422
2
Jump to solution
06-02-2022 09:24 PM
ChrisRoberts2
Occasional Contributor III

Hi All

I have constructed an Arcade expression to parse field values in from a selected feature (in Field Maps) to a url and open up and fill in an online form:

var url = "https://xxxx.gov.au/xxxx/xxxxx/SmartForm.html?formCode=MRF"+"&"+$feature["doc_no"]+"&"+$feature["f1_lichold"]+"&"+$feature.reader+"&DEWNR staff"+"&Annual"
return url

It work fione except for when a name in "f1_lichold" has an & in their name eg D & S Smith.  The form just fills in D as the name and fails to complete the rest of the values.

I am assuming that "&" is considered as a break, but is there anyway I can construct the url above to avoid this and fill in the name as D & S Smith?

Note I have also tried just creating a link in the pop up as so 

https://xxx.xxx.gov.au/xxxx/xxx/SmartForm.html?formCode=MRF&{doc_no}&{f1_lichold}&{reader}&DEWNR staff&Annual

But the result is the same

 

Cheers

Chris

1 Solution

Accepted Solutions
ChristopherCounsell
MVP Regular Contributor
2 Replies
ChristopherCounsell
MVP Regular Contributor
ChrisRoberts2
Occasional Contributor III

Thanks for the tip

Adding UrlEncode prior to the offending field worked

"https://xxxxx.gov.au/xxxxxx/xxxx/SmartForm.html?formCode=MRF"+"&"+$feature["doc_no"]+"&"+UrlEncode($feature["f1_lichold"])+"&"+$feature.reader+"&DEWNR staff"+"&Annual"