Problem when concatenating choice options field
Posted: Thu Nov 12, 2015 5:15 pm
I’ve run into something I’m not sure how to resolve. I have 5 textboxes. They are all linked to the same “choices database file”, but to different fields within the file for the “choice values field” property. For the “choice options field” property, I have several columns selected to display multiple columns of data in the drop down list of the textbox (for example: CSTRS#,CSGRP#,CSDIV#). This works fine. The “choice values field” property assigns the correct data to the textbox and all is good.
Now, what I’ve been asked to do is to capture the contents of the selected data in the drop down list and fill-in the remaining textboxes that are displayed with the data displayed in the columns of the drop down list of the current selected textbox. What I did to make this possible is for each textbox I changed the “choice options field” property to list the column data concatenated together with commas (for example: CSTRS# || ',' || CSGRP# || ',' || CSDIV#). Then in the onselect event of the textbox I capture the comma delimited string using getElementValue(); Then I parse the string using the javascript split(‘,’) method on the string. This works great and produces an array of the values in each column. Then I assign the individual array values to the textboxes.
This is my code in the onselect event of a textbox:
var choiceString = getElementValue('I_9_45');
var choiceValues = choiceString.split(',');
if (choiceValues.length > 0 ) {
changeElementValue('I_9_45',choiceValues[0]);
changeElementValue('I_11_45',choiceValues[1]);
changeElementValue('I_13_45',choiceValues[2]);
changeElementValue('I_15_45',choiceValues[3]);
changeElementValue('I_17_45',choiceValues[4]);
}
All of this works until I hit the Enter key and send that values back to the server. For some reason if the remaining 4 textboxes have their “choice options field” property set to a concatenated list (CSTRS# || ',' || CSGRP# || ',' || CSDIV#) the values in the textboxes that are updated with changeElementValue() function are seen as invalid. But if I change the “choice options field” property back to separate columns (CSTRS#,CSGRP#,CSDIV#) for the 4 remaining textboxes that have had nothing selected yet from their lists, everything goes well and the values are accepted.
I have tried using applyProperty on the ‘value’ and ‘choice value’ properties of each text box instead of changeElementValue(), but that failed also. Is there a way that I can update the textboxes when their “choice options fields” property is set to display only one column of concatenated data? Should I use something other than the changeElementValue()? Is there another property that also needs to be updated along with the value property when using the database driven properties of the textbox? Any guidance or suggestions on this topic would be greatly appreciated.
Now, what I’ve been asked to do is to capture the contents of the selected data in the drop down list and fill-in the remaining textboxes that are displayed with the data displayed in the columns of the drop down list of the current selected textbox. What I did to make this possible is for each textbox I changed the “choice options field” property to list the column data concatenated together with commas (for example: CSTRS# || ',' || CSGRP# || ',' || CSDIV#). Then in the onselect event of the textbox I capture the comma delimited string using getElementValue(); Then I parse the string using the javascript split(‘,’) method on the string. This works great and produces an array of the values in each column. Then I assign the individual array values to the textboxes.
This is my code in the onselect event of a textbox:
var choiceString = getElementValue('I_9_45');
var choiceValues = choiceString.split(',');
if (choiceValues.length > 0 ) {
changeElementValue('I_9_45',choiceValues[0]);
changeElementValue('I_11_45',choiceValues[1]);
changeElementValue('I_13_45',choiceValues[2]);
changeElementValue('I_15_45',choiceValues[3]);
changeElementValue('I_17_45',choiceValues[4]);
}
All of this works until I hit the Enter key and send that values back to the server. For some reason if the remaining 4 textboxes have their “choice options field” property set to a concatenated list (CSTRS# || ',' || CSGRP# || ',' || CSDIV#) the values in the textboxes that are updated with changeElementValue() function are seen as invalid. But if I change the “choice options field” property back to separate columns (CSTRS#,CSGRP#,CSDIV#) for the 4 remaining textboxes that have had nothing selected yet from their lists, everything goes well and the values are accepted.
I have tried using applyProperty on the ‘value’ and ‘choice value’ properties of each text box instead of changeElementValue(), but that failed also. Is there a way that I can update the textboxes when their “choice options fields” property is set to display only one column of concatenated data? Should I use something other than the changeElementValue()? Is there another property that also needs to be updated along with the value property when using the database driven properties of the textbox? Any guidance or suggestions on this topic would be greatly appreciated.