Hi,
I'm working on an application in a manufacturing environment where a user will
be able to use various criteria to generate a list of serial numbers for parts
that were tested in the factory. The criteria are things like base part number
(such as xxx-xxx), part number (xxx-xxx-01), month tested, test process name,
etc., and each will have its own multiple-select menu.
I'm using ':onchange' and remote_function to update the next menu in the form,
which works fine if you only select one item on the list. If you select more
than one, it only sends the first item to the remote function. I can get the
same code to work if I make each menu its own form and submit the form to the
same remote function. That's probably confusing, so here's an example:
<%= select_tag(:part_nbr_base,
options_for_select(@part_nbr_bases),
:onchange => remote_function(
:update => "part_nbr_div",
:with => "'part_nbr_base='+value",
:url => { :action => :make_part_nbr_menu }
),
:multiple =>'multiple',
:size => '5'
) %>
Is there an easy way to tell it to send all the selected values? I've done
this before in sajax for PHP, but the Javascript code was a bit messy and I
figure there's an easier way to do it. But for what it's worth, I used
something like this with sajax:
function get_menu() {
formObj = document.getElementById("parents");
var len;
len = formObj.length;
var k = 0;
for(i=0;i<len;i++) {
if(formObj.options[i].selected) {
k++;
}
}
var x = new Array(k);
var j = 0;
for(i=0;i<len;i++) {
if(formObj.options[i].selected) {
x[j] = formObj.options[i].value;
j++;
}
}
x_getSelectMenu(x, set_result);
}
I really appreciate any help, and I'm really glad to see a Portland Ruby group
start up. The Rails mailing list had way to many posts to keep up with.
Thanks,
Bryan
_______________________________________________
PDXRuby mailing list
[email protected]
IRC: #pdx.rb on irc.freenode.net
http://lists.pdxruby.org/mailman/listinfo/pdxruby