Let's say I have a form with a drop-down list field called "Hardware". Is it possible to have the next field (a text field?) "autopopulate" the Serial Number for the hardware chosen...preferably w/o having to get into writing code?!
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
yes this is possible with the boundItem property, but you'll need at least one script.
1. Create a DDL with your elements
2. Define the bound items of the value in the binding tab of the Object palette.
3. Add this script (its language is FormCalc not JavaScript) in the change event of the DLL:
Textfield1.rawValue = $.boundItem(xfa.event.change)
Views
Replies
Total Likes
Hi,
yes this is possible with the boundItem property, but you'll need at least one script.
1. Create a DDL with your elements
2. Define the bound items of the value in the binding tab of the Object palette.
3. Add this script (its language is FormCalc not JavaScript) in the change event of the DLL:
Textfield1.rawValue = $.boundItem(xfa.event.change)
Views
Replies
Total Likes
Here's the problem, this stuff is over my head.
When you say "Define the bound items..." I know WHERE you talking about but do you mean to actually put the serial number in as the Value (instead of just the 1, 2, 3, etc)?
When it comes to script, I'm pretty ignorant on all of it.
As I've not gotten very far with the form, I'll put the code here for the two fields. Can you tell me exactly where in here I should put the script you mentioned above?
<field name="DropDownList1" y="25.4mm" x="6.35mm" w="92.075mm" h="12.7mm">
<ui>
<choiceList>
<border>
<?templateDesigner StyleID aped3?>
<edge stroke="lowered"/>
</border>
<margin/>
</choiceList>
</ui>
<font typeface="Century Gothic"/>
<margin topInset="1mm" bottomInset="1mm" leftInset="1mm" rightInset="1mm"/>
<para vAlign="middle"/>
<caption reserve="12.9636mm">
<para vAlign="middle"/>
<value>
<text>Item:</text>
</value>
</caption>
<items>
<text>LB-FL-001</text>
<text>LB-FL-002</text>
<text>LB-FL-003</text>
<text>LB-FL-004</text>
<text>LB-FL-005</text>
<text>LB-FL-006</text>
<text>LB-FL-C001</text>
<text>LB-FL-CP001</text>
</items>
<items save="1" presence="hidden">
<text>6TSGMG1</text>
<text>HRSGMG1</text>
<text>3</text>
<text>4</text>
<text>5</text>
<text>6</text>
<text>7</text>
<text>8</text>
</items>
</field>
<field name="TextField1" y="41.275mm" x="6.35mm" w="63.5mm" h="9.525mm">
<ui>
<textEdit>
<border>
<?templateDesigner StyleID aped3?>
<edge stroke="lowered"/>
</border>
<margin/>
</textEdit>
</ui>
<font typeface="Century Gothic"/>
<margin topInset="1mm" bottomInset="1mm" leftInset="1mm" rightInset="1mm"/>
<para vAlign="middle"/>
<caption reserve="27.2367mm">
<para vAlign="middle"/>
<value>
<text>Serial Number:</text>
</value>
</caption>
Views
Replies
Total Likes
Let me try this. I found a form, a sample form from a livecycle book I bought a while back, that does what I want.
There's a state field and a tax field. The tax field populates based on what state is chosen in the state field.
Where do I keep the values for the states?
Here's the code:
<script contentType="application/x-javascript">if(xfa.event.newText == "Connecticut"){
tax.rawValue = ct.value;
}else if(xfa.event.newText == "New Jersey"){
tax.rawValue = parseInt(nj.value);
}else if(xfa.event.newText == "New York"){
tax.rawValue = ny.value;
}
</script>
Views
Replies
Total Likes