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.

Using the text and not the value of a filed

Avatar

Former Community Member
Hi there,

I'm programming a pdf form using life cycle, I'm using the following script in a "SEND TO" button in order to email an XML file with the data extracted from the form:



var emailAddress = F.P1.Line.rawValue;

var veicle = F.P1.Vehicle.rawValue;

var shipper = F.P1.Shipper.rawValue;

var date = F.P1.Date.rawValue;

event.target.submitForm({cURL:"mailto:"+emailAddress+"?subject=Booking request from "+shipper+" date:"+date+" &body=Dear Sirs,Please find attached the completed PDF booking form for the following "+veicle+".",cSubmitAs:"XML",cCharset:"utf-8"});



The problem is that I would like to use in a variable the text and not the value of the F.P1.Line.raw field.



Thanks in advance
2 Replies

Avatar

Former Community Member
Hi,



This is not the appropriate forum to post this type of question. Please post all designer related queries in LiveCYcle Designer Forum to receive better response.



From you query I understand you have a dropdown box with name as "Line". And you want to the "text" part of the selected item and not the "value" part. If it is so then do the following -



1. Write the below code in onCHange event of your dropdown box.



var ddValue = this.boundItem(xfa.event.newText);

var nodeList = this.resolveNode("#items").nodes;

var ddText = null;

for (var i = 0; i < nodeList.length; i++)

{

if (this.boundItem(nodeList.item(i).value) == ddValue)

{

ddText = nodeList.item(i).value;

break;

}

}

global.selectedtxt = ddText;



In the above code I am basically getting the "text" part of the item selected and then I am storing it in a global variable.



2.

Write the below code on click event of your button -



var emailAddress = global.selectedtxt;



Hope this helps.



Thanks,

Shivajiv.

Avatar

Former Community Member
Dear Shivajiv,<br />I really apreciate your help, I thougth this was the rigth forum, I'm sorry for the misunderstanding.<br />Your script worked well but the problem is that I can use the variable only for other pourposes but the send button (by pressing it) continue to produce an email withand XML file wich shows the " value" and not the "text" in the <Line> tag.<br />I hope you can help me again.<br /><br />Bregards<br />Max