hugeness Posted January 5, 2010 Share Posted January 5, 2010 Hi have set up a multi page form.. nested in page 2 is a combo box from the qforms site that allows a box to be populated from a box next to it... <TD ALIGN="Left" VALIGN="Top"><strong>Services:</strong><BR> <SELECT NAME="Users" SIZE="8" MULTIPLE STYLE="width: 250px;" onDblClick="objForm.Users.transferTo('ts6');"> <OPTION VALUE="1">value</OPTION> <OPTION VALUE="2">value 2</OPTION> <OPTION VALUE="3">value 3</OPTION> <OPTION VALUE="4">value 4</OPTION> <OPTION VALUE="5">Charge entry</OPTION> <OPTION VALUE="6">value 5</OPTION> <OPTION VALUE="7">value 6</OPTION> <OPTION VALUE="8">value 7</OPTION> <OPTION VALUE="9">value 8</OPTION> <OPTION VALUE="10">value 9</OPTION> <OPTION VALUE="11">value 10(i.e. patient reminder calls or statement calls)</OPTION> <OPTION VALUE="12">value 11</OPTION> <OPTION VALUE="13">value 12 </OPTION> </SELECT> </TD> <TD WIDTH="50" ALIGN="Center" VALIGN="Middle"> <INPUT TYPE="Button" VALUE=">>" onClick="objForm.Users.transferTo('ts6', true, 'all');" STYLE="width: 30px;"><BR> <INPUT TYPE="Button" VALUE=">" onClick="objForm.Users.transferTo('ts6');" STYLE="width: 30px;"><BR> <BR> <INPUT TYPE="Button" VALUE="<" onClick="objForm.Users.transferFrom('ts6');" STYLE="width: 30px;"><BR> <INPUT TYPE="Button" VALUE="<<" onClick="objForm.Users.transferFrom('ts6', true, 'all');" STYLE="width: 30px;"><BR> </TD> when i do the dump for the javascript, it accurately shows all the output for the page, but on the next page the only value carried over from the combo box is the last value in the list. (ie ts6 = 1,2,3,4,5 etc) but on the next page it only shows... INSERT INTO table (columns.....,ts6) VALUES (values....,'5') i assume this is something to do with arrays, and setting the option values with [ ] but not very experienced with this so any help appreciated. Quote Link to comment Share on other sites More sharing options...
Psycho Posted January 5, 2010 Share Posted January 5, 2010 The values need to be passed as an array, therefore you need to give the field a name that will be interpreted as an array. I.e. add square brackets to the field name: <SELECT NAME="Users[]" SIZE="8" MULTIPLE STYLE="width: 250px;" onDblClick="objForm.Users.transferTo('ts6');"> You can then reference the values of the field in the processing page via $_POST['Users'], which will be an array variable Quote Link to comment Share on other sites More sharing options...
hugeness Posted January 5, 2010 Author Share Posted January 5, 2010 Hi thanks for the response, i think that would work normally, but the variable being sent is actually being sent through the second box, 'ts6' .... this is being populated through the qforms library... the variable dump shows that all the variables transfered to this box are listed... i'll try the qforms mailing list and post back here.. i did try your solution, and the functionality on the combo box stopped.. Quote Link to comment Share on other sites More sharing options...
Psycho Posted January 5, 2010 Share Posted January 5, 2010 Where is the field "ts6"? You didn't list it in your code above. Quote Link to comment Share on other sites More sharing options...
hugeness Posted January 5, 2010 Author Share Posted January 5, 2010 onDblClick="objForm.Users.transferTo('ts6');"> the first box, users, allows a selection from the list to be transfered to the second box ts6, which contains the values submitted ... looks like http://www.pengoworks.com/qforms/docs/examples/containers.htm theres probably a better way to do it though! if you can think of one please let me know, these qforms people are great, but this has been around for years! thanks again Quote Link to comment Share on other sites More sharing options...
hugeness Posted January 5, 2010 Author Share Posted January 5, 2010 <TR> <TD ALIGN="Left" VALIGN="Top"><strong>Services:</strong><BR> <SELECT NAME="Users" SIZE="8" MULTIPLE STYLE="width: 250px;" onDblClick="objForm.Users.transferTo('ts6');"> <OPTION VALUE="1">Credentialing</OPTION> <OPTION VALUE="2">Consulting: practice mgt, chart auditing, financial mgt, compliance</OPTION> <OPTION VALUE="3">Custom programming</OPTION> <OPTION VALUE="4">Coding</OPTION> <OPTION VALUE="5">Charge entry</OPTION> <OPTION VALUE="6">Claims processing & payer follow-up</OPTION> <OPTION VALUE="7">Tom Kenny</OPTION> <OPTION VALUE="8">Printed statements to patients</OPTION> <OPTION VALUE="9">Patient: soft collections</OPTION> <OPTION VALUE="10">Patient: hard collections</OPTION> <OPTION VALUE="11">Call center services (i.e. patient reminder calls or statement calls)</OPTION> <OPTION VALUE="12">Billing: private practice</OPTION> <OPTION VALUE="13">Billing: hospital-owned physicians</OPTION> <OPTION VALUE="14">Billing: institutional facility</OPTION> <OPTION VALUE="15">Other - as listed by you</OPTION> </SELECT> </TD> <TD WIDTH="50" ALIGN="Center" VALIGN="Middle"> <INPUT TYPE="Button" VALUE=">>" onClick="objForm.Users.transferTo('ts6', true, 'all');" STYLE="width: 30px;"><BR> <INPUT TYPE="Button" VALUE=">" onClick="objForm.Users.transferTo('ts6');" STYLE="width: 30px;"><BR> <BR> <INPUT TYPE="Button" VALUE="<" onClick="objForm.Users.transferFrom('ts6');" STYLE="width: 30px;"><BR> <INPUT TYPE="Button" VALUE="<<" onClick="objForm.Users.transferFrom('ts6', true, 'all');" STYLE="width: 30px;"><BR> </TD> <TD ALIGN="Left" VALIGN="Top"> <B>Your top 6 in order of importance:</B><BR> ***** Sorry, i see what you mean.... ************* the box comes here... <SELECT NAME="ts6" SIZE="8" MULTIPLE STYLE="width: 250px;" onDblClick="objForm.Users.transferFrom('ts6');"> </SELECT> </TD> <TD WIDTH="50" ALIGN="Center" VALIGN="Middle"> <INPUT TYPE="Button" VALUE="/\" onClick="objForm.ts6.moveUp();" STYLE="width: 30px;"><BR> <INPUT TYPE="Button" VALUE="\/" onClick="objForm.ts6.moveDown();" STYLE="width: 30px;"><BR> </TD> </TR> <TR><TD COLSPAN="4" ALIGN="Center"> <BR> <INPUT TYPE="Button" VALUE="Form Dump" onClick="objForm.dump();"> <INPUT TYPE="Button" VALUE="Reset" onClick="objForm.reset();"> </TD></TR> Quote Link to comment Share on other sites More sharing options...
Psycho Posted January 5, 2010 Share Posted January 5, 2010 Then you need to change the "ts6" field to an array: "ts6[]" Quote Link to comment Share on other sites More sharing options...
hugeness Posted January 5, 2010 Author Share Posted January 5, 2010 response from qforms: It's been a little while since I worked with qForm, but the select box values are not sent as array, but as a simple string. However, it only sends the values of only the selected elements. My guess would be that even though all the values are showing, that not all the values are selected. qForms has a container object that will select all the elements in the select box before submitting http://www.pengoworks.com/qforms/docs/objects_field.htm#container. This should hopefully fix your problem. Dean sadly didnt work... soo.. ts6[] breaks the functionality just as users[] did.. if theres another way to build one of these that anyone knows of, be great to know. Quote Link to comment Share on other sites More sharing options...
Psycho Posted January 5, 2010 Share Posted January 5, 2010 When you changed the field name to "ts6[]", did you change all the event calls to use the new name? Ex: onClick="objForm.Users.transferFrom('ts6[]'); Quote Link to comment Share on other sites More sharing options...
hugeness Posted January 7, 2010 Author Share Posted January 7, 2010 yep. it still broke it Quote Link to comment Share on other sites More sharing options...
hugeness Posted January 7, 2010 Author Share Posted January 7, 2010 the information i need is in the form dump .. do you know if there is any way i can grab this and use it to pass the variable string .. for example i just moved 3 items over to ts6, clicked form dump and got all the values in the form, including ts6=1,3,4 if i could sort out a regex. to select this string, i could still use the setup. thanks! Quote Link to comment Share on other sites More sharing options...
Psycho Posted January 7, 2010 Share Posted January 7, 2010 You could create an onsubmit trigger that fires a function which iterates through all options in the select box and populates those values into a hidden field (delimited with a character such as a comma) Example: function populateSelectValues() { var selectField = getElementById('ts6'); var hiddenField = getElementById('hidden_ts6'); var values = new Array(); for (var i=0; i<selectField.options.length; i++) { values[values.length] = selectField.options[i].value; } hiddenField.value = values.join(); } Personally I think the original problem can be solved. It's just difficult without having all the code to work with. Plus, I just don't have the time to shift through it. Quote Link to comment Share on other sites More sharing options...
hugeness Posted January 12, 2010 Author Share Posted January 12, 2010 I found this amazing example which did exactly what i wanted... http://mattkruse.com/javascript/optiontransfer/combined_source.html the only issue i have now is that i actully need two of these within the same form.. is there a simple way to do this, or do i need to duplicate the code, then rename all the variables and functions? thanks! Quote Link to comment Share on other sites More sharing options...
srujana Posted January 12, 2010 Share Posted January 12, 2010 I found this amazing example which did exactly what i wanted... http://mattkruse.com/javascript/optiontransfer/combined_source.html the only issue i have now is that i actully need two of these within the same form.. is there a simple way to do this, or do i need to duplicate the code, then rename all the variables and functions? thanks! I have used this code in my site. It is really good. You can have 2 objects for the same functions.. Here is what I have done in my page: var opt = new OptionTransfer("from","to"); opt.setAutoSort(true); opt.setDelimiter(","); opt.setStaticOptionRegex("static"); opt.saveRemovedLeftOptions("removedLeft"); opt.saveRemovedRightOptions("removedRight"); opt.saveAddedLeftOptions("addedLeft"); opt.saveAddedRightOptions("addedRight"); opt.saveNewLeftOptions("newLeft"); opt.saveNewRightOptions("newRight"); Similarly, you can have another in the same form I guess. var optSecond = new OptionTransfer("first","second"); Hope it helps ! Quote Link to comment Share on other sites More sharing options...
hugeness Posted January 20, 2010 Author Share Posted January 20, 2010 Thank you for that, I also found this one which at first sight looks different, but can be used in the same way... http://code.google.com/p/jquery-asmselect/ I found this amazing example which did exactly what i wanted... http://mattkruse.com/javascript/optiontransfer/combined_source.html the only issue i have now is that i actully need two of these within the same form.. is there a simple way to do this, or do i need to duplicate the code, then rename all the variables and functions? thanks! I have used this code in my site. It is really good. You can have 2 objects for the same functions.. Here is what I have done in my page: var opt = new OptionTransfer("from","to"); opt.setAutoSort(true); opt.setDelimiter(","); opt.setStaticOptionRegex("static"); opt.saveRemovedLeftOptions("removedLeft"); opt.saveRemovedRightOptions("removedRight"); opt.saveAddedLeftOptions("addedLeft"); opt.saveAddedRightOptions("addedRight"); opt.saveNewLeftOptions("newLeft"); opt.saveNewRightOptions("newRight"); Similarly, you can have another in the same form I guess. var optSecond = new OptionTransfer("first","second"); Hope it helps ! 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.