issue with changing select control values inside repeat table

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

issue with changing select control values inside repeat table

Jency Thomas

Hi,

 

I am facing an issue with a select control which occurs inside a repeat table.

 

I have a repeat table whose id is VehicleDetails with 2 combo boxes say, ‘make’ and ‘model’. An Add button adds more rows to the repeat table.

I need to load the Model combo based on the make selected in the make combo. So, on the value changed event of make, I do an xforms submission which loads all the model corresponding to the make to the instance INST_cmbModel

 

<xforms:repeat id=”VehicleDetails” nodeset="instance('main')/PAGE1/tblVehicles[position()&lt;last()]" >

          <xforms:select1 ref=”make”>

                   <xforms:itemset nodeset="instance('INST_cmbMake')/item">

                              <xforms:label ref="label"></xforms:label>

                              <xforms:value ref="value"></xforms:value>

              </xforms:itemset>

<xforms:send submission="populateModel" ev:event="xforms-value-changed"></xforms:send>

          </xforms:select1>

<xforms:itemset nodeset="instance('INST_cmbModel')/data/item">

                              <xforms:label ref="label"></xforms:label>

                              <xforms:value ref="value"></xforms:value>

              </xforms:itemset>

          </xforms:select1>

</xforms:repeat>

<xforms:trigger>

                    

                     <xforms:label>Add</xforms:label>

                    

                     <xforms:insert at="index('VehicleDetails')" nodeset="instance(‘main’)/PAGE1/tblVehicles" position="after" ev:event="DOMActivate"> </xforms:insert>

                    

</xforms:trigger>

 

 

Submission which populates Model:

 

  <xforms:submission action="PopulateModel.action" id="populateModel" method="post" ref="instance('INSTANCE')/PAGE1/tblVehicles[index('VehicleDetails')]/make" replace="instance" instance="INST_cmbModel">

 

The instance that is replaced (INST_cmbModel) is:

 

         <xforms:instance xmlns="" id="INST_cmbModel">

            <main>

             <data>

<item><label/><value/></item>

</data> 

</main>

         </xforms:instance>

 

The issue is that:

I changed the value in the ‘make’ combo of the 1st row and corresponding model loaded in the model combo of the 1st row. Now I added a 2nd row using Add button. On value changed event of the make combo of the 2nd row, I do a submission which replaces the instance INST_cmbModel. So the ‘model’ in the 2nd row as well as the 1st row gets changed corresponding to the make selected in the 2nd row [ because the model combo in both rows refer to the same nodeset]. How can I maintain the model list in the 1st row while chaging the make in the 2nd row?

 

I did some workarounds as inserting multiple <data> nodes to 'INST_cmbModel' on value changed event of make and changing the nodeset of model combo to instance('INST_cmbModel')/data[index('VehicleDetails')]/item; but still the issue is there because when I click on the 2nd row, index('VehicleDetails') becomes 2 and this gets affected for the model in the 1st combo too.

 

Please suggest a solution so that on value changed event of the Make combo, only the corresponding model changes. I’m almost stuck with this issue.

 

Thanks in advance

Jency

 

 

 



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: issue with changing select control values inside repeat table

Alessandro Vernet
Administrator
Jency,

On Feb 5, 2008, at 4:28 AM, Jency Thomas wrote:

> I changed the value in the ‘make’ combo of the 1st row and  
> corresponding model loaded in the model combo of the 1st row. Now I  
> added a 2nd row using Add button. On value changed event of the make  
> combo of the 2nd row, I do a submission which replaces the instance  
> INST_cmbModel. So the ‘model’ in the 2nd row as well as the 1st row  
> gets changed corresponding to the make selected in the 2nd row  
> [ because the model combo in both rows refer to the same nodeset].  
> How can I maintain the model list in the 1st row while chaging the  
> make in the 2nd row?

Instead of loading the instance you want to use in the second drop-
down based upon value-changed in the first drop-down, I would have one  
static instance which contains all the models and all the makes for  
each model, within a hierarchical structure in an XML instance. Then  
the itemset for the second drop-down will point on the right part of  
the instance based on what is selected in the first drop-down. I hope  
this helps,

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws