Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Want only the user entered values on the xml generated by clicking the button

Avatar

Level 3

data.PNG

Hi All,

Here goes the details of the problem.

1. I have created two textfields(texttfield3 and textfield4) along with an email button in a fragment and binded to an XSD file.textfield3 and textfield4 are user entered fields.

2. On the design page I have created two more fields texfield1 and textfield2 and binded to another XSD.These two fields are read only fields.

3. On preview PDF screen whenever you click on the email button,you get a mail option with an xml file attached to it.

4. whenever you open the xml file,you will get the values of all the four fields.Its given below

<form1>

<TextField1>value1</TextField1>

<TextField2>value2</TextField2>

<TextField3>value3</TextField3>

<TextField4>value4</TextField4>

</form1>

5.But I want only user entered fields to be displayed on the xml page i.e

<form1>

<TextField3>value3</TextField3>

<TextField4>value4</TextField4>

</form1>

6.How can I remove or avoid the read only fields not to be displayed on the xml page???

Thanks in advance

2 Replies

Avatar

Level 10

Hi,

Select the fields you don't want in the XML and go to the Object > Binding tab. Select a 'No data binding' option (or similar, depending on your version of LC Designer).

Parallels Desktop1.png

Good luck,

Niall

Avatar

Level 10

Hi,

If you need to keep the binding on input then I think you have to remove the elements in script, so in the email submit button preSubmit event somthing like;

FormState.value

= $record.saveXML();

var

xsl = <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

     <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

     <xsl:template match="/">

     <xsl:apply-templates/>

     </xsl:template>

     <xsl:template match="TextField3|TextField4">

     <xsl:copy-of select="."/>

     </xsl:template>

     <xsl:template match="TextField1|TextField2">

     </xsl:template>

     </xsl:stylesheet>;

$record.loadXML($record.applyXSL(xsl.toXMLString())

, true, true);

And in the postSubmit event restore the data dom with;

$record.loadXML(FormState.value

, true, true);

Where FormState is a form variable

Note,  I'm still learning xslt but this seems more complicated than I think it should be, standard xslt would have been a three lines as I think the first two xsl:template statements should have been the default, so need not have been specified.  Would be interested to know why they are needed in this xslt if anyone could help.

Thanks

Bruce