I am designing
a form with a combo box dropdown list of a
ll the 51 states and I want the for if i se
lect a state(il) it displays let say the tax rate of
il in a textbox. But I want to do this for all the states
it seems an if statement or xml will be my best bet
and sample or tutorial somewhere
Solved! Go to Solution.
Views
Replies
Total Likes
This is a two part problem, data binding and accessing data sources. The following addresses problem one, data binding. Build an XML instance to express the sales tax rates by state. I did a partial list of states and added 'TaxRates.xml' as the preview data source.
<?xml version="1.0"?>
<form1>
<subform1>
<taxRates>
<State id="" salesTax=""/>
<State id="AK" salesTax="0.00"/>
<State id="AL" salesTax="4.00"/>
<State id="AR" salesTax="6.00"/>
<State id="AZ" salesTax="5.60"/>
<State id="CA" salesTax="8.25"/>
</taxRates>
</subform1>
</form1>
Built an XML schema to describe the XML instance and add it as a data connection. My schema is embedded in the attached form. The schema 'TaxRates.xsd' is attached also.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xfadata="http://www.xfa.org/schema/xfa-data/1.0/">
<xsd:element name="form1">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="subform1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="subform1">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="taxRates"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="taxRates">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="State" maxOccurs="51">
<xsd:complexType>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="salesTax" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Use dynamic binding to bind the state drop-down list to the data connection. In the 'state' data binding specify the Item Text as the attribute 'id' and Item Value as the attribute 'salesTax'.
In the exit event of 'state' add JavaScript to assign the raw value of 'state' to the raw value of 'taxRate'.
// form1.page1.subform1.state::exit - (JavaScript, client)
form1.page1.subform1.taxRate.rawValue = this.rawValue;
Steve
Views
Replies
Total Likes
This is a two part problem, data binding and accessing data sources. The following addresses problem one, data binding. Build an XML instance to express the sales tax rates by state. I did a partial list of states and added 'TaxRates.xml' as the preview data source.
<?xml version="1.0"?>
<form1>
<subform1>
<taxRates>
<State id="" salesTax=""/>
<State id="AK" salesTax="0.00"/>
<State id="AL" salesTax="4.00"/>
<State id="AR" salesTax="6.00"/>
<State id="AZ" salesTax="5.60"/>
<State id="CA" salesTax="8.25"/>
</taxRates>
</subform1>
</form1>
Built an XML schema to describe the XML instance and add it as a data connection. My schema is embedded in the attached form. The schema 'TaxRates.xsd' is attached also.
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xfadata="http://www.xfa.org/schema/xfa-data/1.0/">
<xsd:element name="form1">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="subform1"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="subform1">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="taxRates"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="taxRates">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="State" maxOccurs="51">
<xsd:complexType>
<xsd:attribute name="id" type="xsd:string"/>
<xsd:attribute name="salesTax" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Use dynamic binding to bind the state drop-down list to the data connection. In the 'state' data binding specify the Item Text as the attribute 'id' and Item Value as the attribute 'salesTax'.
In the exit event of 'state' add JavaScript to assign the raw value of 'state' to the raw value of 'taxRate'.
// form1.page1.subform1.state::exit - (JavaScript, client)
form1.page1.subform1.taxRate.rawValue = this.rawValue;
Steve
Views
Replies
Total Likes