Expand my Community achievements bar.

How do I update a text field by assigning an hyperlink with loadXML in ES4?

Avatar

Level 2

I am using a dropdown list to select a court location.

When the location is selected,

the address field and the phoneNo field are updated according to the location selected.

I have tried in vain to get the website field populated with a rich text hyperlink. 

I tried to save the rich text in a variable, but ES4 gives me an error for the escaped quotes (\")

 

var sLoc = "Abbotsford";

var oLink = "<body xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:xfa=\"http://www.xfa.org/schema/xfa-data/1.0/\"><p style=\"letter-spacing:0in\"><a href=\"http://www.provincialcourt.bc.ca/court-location/" + sLoc + "\" style=\"margin-top:0pt;margin-bottom:0pt;text-valign:bottom;font-family:'Helvetica';font-size:8pt\">" + sLoc + "</a></p></body>";

  

courtWebsite.value.exData.loadXML (oLink, false, true);

When I change the escape quotes to single quotes, I don't get an error but:

  1. the PDF preview shows that the update does not work ; and
  2. when I return to the XML view,  the variable is empty where the rich text content used to be. (var oLink = "") and the content of the oLink variable is now a child of the <script> element of the event. 

BTW, it does not resolve the content of sLoc; so replaced sLoc within oLink with the actual content... same problem.

0 Replies