abitaquest Posted June 17, 2014 Report Share Posted June 17, 2014 Hi. I need to collect data from several different drop-downs, then combine the results into a single array in my data table. How would I do that? Example: If I collect 5 as the value for dropdown_1, and 3 for the value of dropdown_2, and 4 for the value of dropdown_3, I would need to be able to use that to create an array in another field (dropdown_values) such as: 5, 3, 4 I'm guessing this is a javascript thing. Any idea how to do that? Thanks for any help. Quote Link to comment Share on other sites More sharing options...
Jan Posted June 18, 2014 Report Share Posted June 18, 2014 Hello abitaquest, As far as I know, there is an article how Concatenate/Combine two fields into one field. In your case, if I understand correctly, dropdowns will be dynamic fields. I have edited the script: <SCRIPT LANGUAGE="JavaScript"> function concatenate() { var elems = document.getElementsByTagName("*"); for (var i=0, m=elems.length; i<m; i++) { if (elems[i].id && elems[i].id.indexOf("InsertRecorddropdown_1") != -1) { var position1 = elems[i].value; } } var elems = document.getElementsByTagName("*"); for (var i=0, m=elems.length; i<m; i++) { if (elems[i].id && elems[i].id.indexOf("InsertRecorddropdown_2") != -1) { var position2 = elems[i].value; } } var allpositions = position1 + ", " + position2; document.getElementById("InsertRecorddropdown_values").value = allpositions; } document.getElementById("caspioform").onsubmit=concatenate; </SCRIPT> I hope it helps. abitaquest 1 Quote Link to comment Share on other sites More sharing options...
abitaquest Posted June 19, 2014 Author Report Share Posted June 19, 2014 Thanks! That helped solve my issue! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.