How to interact xfa attribute with javaScript

Avatar

Avatar

greenlnd34

Avatar

greenlnd34

greenlnd34

26-03-2015

I want to change text with bold font in javaScript. How can I update <p> with required attribute in javaScript?

<draw x="9.525mm" y="69.85mm" minH="5.08mm">

            <font typeface="Verdana" size="9pt"/>

            <value>

               <exData contentType="text/html">

                  <body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><p style="text-decoration:none;letter-spacing:0in">Kredia do te perdoret nga<span style="xfa-spacerun:yes"> </span><span style="font-weight:bold">Kredimarresi<span style="xfa-spacerun:yes"> </span></span>per</p></body>

               </exData>

            </value>

            <ui>

               <textEdit/>

            </ui>

            <margin leftInset="0.5mm" rightInset="0.5mm" topInset="0.5mm" bottomInset="0.5mm"/>

            <para vAlign="middle"/>

         </draw>

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372
_Bruce_Robertson
MVP

26-03-2015

Hi,

You can make some simple changes using span objects, so;

var spans = [];

spans.push({text:"Kredia do te perdoret nga "});

spans.push({text:"Kredimarresi", fontWeight:700});

spans.push({text:" per"});

var xHTML = util.spansToXML(spans);

Text1.value.exData.loadXML(xHTML, false, true);

Would give you something similar to your sample.

There are some other examples Adobe LiveCycle Designer Cookbooks by BR001: xmlToSpans but if you want to use one of the attributes that the span object does not support you could try using E4X (a XML extension for JavaScript) and there's a sample of that Adobe LiveCycle Designer Cookbooks by BR001: Adding values in a form to an email

Regards

Bruce

Answers (2)

Answers (2)

Avatar

Avatar

greenlnd34

Avatar

greenlnd34

greenlnd34

26-03-2015

Almost right that way. I want to change <p> content and style through form JavaScript. Is it possible?

Avatar

Avatar

mouslander

Avatar

mouslander

mouslander

26-03-2015

I am not sure I understand the question. You want to update the <p> tag throughout the document similar to the way you would change CSS?