Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Populate ComboBox with data from Database

    Hello there,

    Taking the /built-in-ds sample code and working on it. In there the DynamicForm's Combobox gets populated with data from the valueMap defined in their respective datasource file.
    Now in my case I have some some combo box which needs to also get populated with data from the database table. DOnt know how to do this. At present the combox data which i have defined in my datasource with valueMap gets poplulated but the one's i want them to get populated from db is shown as Textbox.

    Below is my datasource which i registered with the dynamicform and a listgrid.

    For e.g. this field fptype gets populated with the data and shown as COmbobox but dfid which i need to populate from the database is not and shown as textfield. Please help.

    cheers
    Zolf

    Code:
     
    <DataSource ID="productDS" serverType="sql" tableName="pdu">
    	<fields>
    		<field name="id" type="sequence" hidden="true" primaryKey="true" />
    		<field name="name" title="Product Name" type="ntext" length="128" required="true"/>
    		<field name="code" title="Code" type="integer" required="true"/>
    		
    		<field name="fptype" title="FDO Product Type" type="text" length="11" required="true">
    		<valueMap>
                    <value>Drugs</value>
                    <value>Supplements</value>
                    <value>Others</value>
                </valueMap>
            </field>
            
    		<field name="dfid" title="Dosage Form" type="integer" foreignKey="dosformDS.id" required="true"/>
    			
    		<field name="pgr" title="Product Group" type="integer" foreignKey="productGroupDS.id" required="true"/>
    		
    		<field name="ro" title="Route Of Administration" type="integer" foreignKey="routeOfAdminDS.id" required="true"/>
    		
    		<field name="pu" title="Package Unit" type="text" length="5" required="true">
    		<valueMap>
                    <value>Kg</value>
                    <value>Liter</value>
                    <value>Pcs</value>
                    <value>Other</value>
                </valueMap>
            </field>
            
    		<field name="supck" title="Single unit Package / Batch" type="integer" required="true"/>
    		<field name="mupck" title="Multiple unit Package / Batch" type="integer" required="true"/>
    		
    		<field name="nper" title="FDO Name Farsi" type="ntext" length="128" required="true"/>
    		<field name="neng" title="FDO Name English" type="text" length="128" required="true"/>
    		
    		<field name="gcde" title="Generic Code" type="integer" required="true"/>
    		<field name="dcde" title="Drug Code" type="integer" required="true"/>
    			
    		<field name="oirc" title="Old IRC" type="integer" required="true"/>
    		<field name="nirc" title="New IRC" type="integer" required="true"/>
    		<field name="gtin" title="GTIN" type="integer" required="true"/>
    			
    		<field name="slife" title="Shelf Life" type="integer" required="true">
    			<valueMap>
    				<value>24</value>
    			</valueMap>
    		</field>
    		
    		<field name="status" title="Status" type="text" length="8" required="true">
    			<valueMap>
    				<value>Active</value>
    				<value>Inactive</value>
    			</valueMap>
    		</field>	
    	</fields>
    </DataSource>

    #2
    Start by reading the QuickStart Guide, focusing on Data Binding, and take a look at the related component samples.

    Specifically you are looking for optionDataSource, but we'd recommend revisiting this whole area of the docs since you were not already familiar with this core concept.
    Last edited by Isomorphic; 11 May 2015, 22:12.

    Comment

    Working...
    X