Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How to fill a text box with feild entry values?

Avatar

Former Community Member
I am trying to figure out how to take the value of some of my fields and populate those values in other text area's of my form with text wrapped around it. I also want to have that text feild hidden unless a check box is selected on the first body page.



Example: If the user selects the Lease checkbox [Quote] a subform [LeaseData] appears so they can fill in the feilds related to the lease. I was able to set the checkbox to show the sub form when it was selected but now I need those feild values from the subform to display on other pages if the checkbox is selected.



So I have a feild called Monthly Cost [MonthlyCost] in that subform[LeaseData] on one of my body pages and I want to have that value show up in a text block at the footer of one of my Master Pages so it will display like this:



Only $[MonthlyCost]a month!



Any ideas????



Any ideas?
1 Reply

Avatar

Former Community Member
I assume you're problems lie in gaining access, via scripting, to the various objects which make-up your desired solution.



As you've indicated, you've figured-out how to make the LeaseData subform visible only when the Quote check box is checked.



From there, you need to show the calculated monthly cost, based on the numbers entered into the LeaseData subform's fields, at the bottom of every page of your form.



To do this, you simply need to place a numeric field at the bottom of the Master Pages (objects on the Master Pages are displayed on every Body Page) and give it a calculation script that handles making the field invisible until there's enough data entered into the LeaseData subform for you to calculate the monthly cost -- at which point you can get the monthly cost from the LeaseData subform and display it (by assigning it to the value of the numeric field on the Master Pages) on all pages of your form.



In the Calculate event of the numeric field on the Master Pages, you can access the fields on the Body Pages by using a SOM expression that begins with the name of your form ("form1" by default) followed by the name of the Body Page subform containing the fields you're interested in and then completing the SOM expression to the field itself (in JavaScript here):



// get the calculate montly payment value from the LeaseData subform on the first Body Page:

form1.resolveNode("#subform[0]").LeaseData.MonthlyPayment.rawValue;


I've attached a sample form which I attempted to structure in the way you described it should be, along with a numeric field on the Master Pages which is only visible when there's a valid monthly payment calculated in the LeaseData subform located on the first Body Page. You can see that the monthly payment is replicated at the bottom of both pages.



Stefan

Adobe Systems