Jump to content

Combo Box only sending one variable in multipage form


hugeness

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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..

Link to comment
Share on other sites

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

Link to comment
Share on other sites

<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>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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 !

Link to comment
Share on other sites

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 !

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.