Hello, I am working with AEM Designer to map a PDF form and use actions on the form. I added two text field objects and bound data to each of them. Then I added an action to set the value of one of the fields to null if the other field is not empty. I am able to save the action and do not get any errors, but upon previewing the form, the action does not work. In the XML source, I noticed that the action was added as a comment:
//+ Type: Action
//+ Result1: SetFieldValue("$Node2","tonull","")
//+ Node2: FormType[0].Page1[0].Make[0]
//+ Node1: FormType[0].Page1[0].Vin[0]
//+ Condition1: TextField("$Node1","notempty","")
//+ ActionName: Vin.exit
if ((this.resolveNode("$").rawValue != null && this.resolveNode("$").rawValue != "")) {
this.resolveNode("Make").rawValue = null;
}
//-
Can anyone tell me why the action was commented out? This is the first time I am working with actions so I am wondering if maybe there is some other form setting that I am missing? Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
Hi, it is NOT commented. // are line comments and not comment ranges. The actual code line is active. When I do the same thing here it works as expected. The way this is done is that on exiting the field in the action (here Vin) the code gets executed. So you must exit Vin before you see the result.
Before Exit:
After Exit:
The action:
Hi, it is NOT commented. // are line comments and not comment ranges. The actual code line is active. When I do the same thing here it works as expected. The way this is done is that on exiting the field in the action (here Vin) the code gets executed. So you must exit Vin before you see the result.
Before Exit:
After Exit:
The action:
Thank you for the clarification. In that case, perhaps I should provide more context because it is still not working for me. We build static PDF forms in AEM Designer that get rendered through AEM servers with XML data based on a data schema. For this test, I mapped a form with the two fields and added the action on one of the fields. When I do a Preview PDF from within AEM Designer, the action does not work. I even tried changing the order of the fields in the hierarchy and it still did not work. Here is my action:
And here is the result in Preview PDF:
Any thoughts on why it does not work in Designer?
Views
Replies
Total Likes
Views
Replies
Total Likes
@TK0215 Different situation - it is a print PDF that you fill based on incoming data. Here my assumption: The data can contain both data values, if it does then VIN shall take precedence and clear field make. You have to remove the current action as it will not help you. A simple form with 2 text field. I simulate your data by using the Default value for both fields. In the initialize event of the field VIN I check the content and empty Make if it is filled.
Preview as Print, no logic applied, both fields show content
With logic in Initialize of Vin
if (this.rawValue != null && this.rawValue != "") {
Make.rawValue = null;
}
If Vin is empty then
Views
Replies
Total Likes
Views
Likes
Replies