IE Complains about 'values' not being defined, even
though that's the first line of the script...
> -----Original Message-----
> From: Paul Johnston [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, October 31, 2000 10:05 AM
> To: Fusebox
> Subject: RE: Multiple Select Box
>
>
> This page works in IE but not in Netscape. Something to do
> with some of the
> objects it uses! I can't be bothered to change it, but if
> you want you can!
>
> Paul
>
> PS Just copy and paste the whole code somewhere on your web
> server. It
> passes a hidden field with a comma-delimited list of all the
> values called
> "hidden_list". This page uses CF to output whatever list is
> passed to it.
>
> --------------page--------------
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>
> <html>
> <head>
> <title>Untitled</title>
> </head>
>
> <body>
>
> <script language="JavaScript">
> var values = new Array('Paul', 'Chris', 'Nick', 'Kevin');
>
> function changeOrder(action) {
> var form = document.forms[0];
> check = String(form.order.value);
> do_update = "yes";
> if (check.match('^\s*$')) {
> alert('You have not selected anything!');
> do_update = "no";
> }
> order_value = form.order.value;
> if (action == 'up' && do_update == 'yes') {
> //alert('up');
> if ( order_value == 0) {
> alert('This value cannot go up any further');
> }
> else {
> // find values of the array
> swap_value1 = values[order_value];
> new_order_value = parseInt(order_value) - 1;
> swap_value2 = values[new_order_value];
> //alert('order value: ' + order_value + ' new
> order value: ' +
> new_order_value);
> //alert('1: ' + swap_value1 + ' 2: ' + swap_value2);
> // swap them over
> values[order_value] = swap_value2;
> values[new_order_value] = swap_value1;
> // repopulate the array
> for(i = 0; i < values.length; i++) {
> form.order.options[i].value = values[i];
> //alert('form.order.options[' + i + ']: ' +
> values[i]);
> }
> refreshSelectBox();
> }
> }
> else {
> //alert('down');
> if ( order_value == ( values.length - 1 ) ) {
> alert('This value cannot go down any further');
> }
> else {
> // find values of the array
> swap_value1 = values[order_value];
> new_order_value = parseInt(order_value) + 1;
> swap_value2 = values[new_order_value];
> //alert('order value: ' + order_value + ' new
> order value: ' +
> new_order_value);
> //alert('1: ' + swap_value1 + ' 2: ' + swap_value2);
> // swap them over
> values[order_value] = swap_value2;
> values[new_order_value] = swap_value1;
> // repopulate the array
> for(i = 0; i < values.length; i++) {
> form.order.options[i].value = values[i];
> //alert('form.order.options[' + i + ']: ' +
> values[i]);
> }
> refreshSelectBox();
> }
> }
> writeList();
> // use this if you want to refresh the page!
> }
>
> function writeList() {
> var form = document.forms[0];
> form.hidden_list.value = "";
> for(i = 0; i < values.length; i++) {
> temp = form.hidden_list.value;
> if ( i != 0 ) {
> form.hidden_list.value = temp + ',' + values[i];
> } else {
> form.hidden_list.value = values[i];
> }
> //alert(form.hidden_list.value);
> }
> }
>
> function refreshSelectBox(){
> // values array holds all the relevant data
> // delete the current select box array
> var form = document.forms[0];
> for(i = 0; i < values.length; i++) {
> // delete the first in the array because we are
> deleting them one by
> one (ie you can't delete the third one if there are only two there)!
> // alert(form.order.options[0].value);
> form.order.options[0] = null;
> }
> for(i = 0; i < values.length; i++) {
> newOption = new Option(values[i], i);
> form.order.options[i] = newOption;
> }
> }
> </script>
>
> <cfif IsDefined("form.hidden_list")>
> List Passed To Form:
> <Cfoutput>#form.hidden_list#</cfoutput><br><br>
> </cfif>
>
> <form method="post" onsubmit="writeList();">
> <script language="JavaScript">
> document.write('<select name="order" size="' +
> values.length + '">');
> refreshSelectBox();
> </script>
> </select>
> <!--- this is to output the array as a list for the next page
> to take --->
> <input type="hidden" name="hidden_list" value="">
> <input type="Button" value="Up" onclick="changeOrder('up');">
> <input type="Button" value="Down" onclick="changeOrder('down');">
> <input type="submit" value="Finished Ordering">
> </form>
>
> </body>
> </html>
>
> --------------page--------------
>
> > -----Original Message-----
> > From: Sean Blenkhorn [mailto:[EMAIL PROTECTED]]
> > Sent: 31 October 2000 15:33
> > To: Fusebox
> > Subject: RE: Multiple Select Box
> >
> >
> >
> > I think he means to have a select box with a size of 5 and
> have any number
> > of items in it.... but have the ability to choose one
> item... and move the
> > item up or down in priority.... as if you are ordering sections
> > of a portal
> > site... or ordering the order of jobs in a queue.
> >
> > I don't have the JS to do this.... but it seems easy enough
> to write from
> > scratch.
> >
> > Sean
> >
> >
> > -----Original Message-----
> > From: David Huyck [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, October 31, 2000 10:03 AM
> > To: Fusebox
> > Subject: Re: Multiple Select Box
> >
> >
> > Neil--
> >
> > > Anyone out there got a script which reorders a multiline
> text menu? for
> > > instance I have 4 items in it :
> > >
> > > 1
> > > 2
> > > 3
> > > 4
> > >
> > > I only want 1 select menu visible with an up button and a
> down button,
> > when
> > > I click the up button it push content up when pusing down - it
> > goes down
> >
> > Do you just mean something like:
> > <select name="pickIt" size="1"><options...></select>
> >
> > I'm not sure what you mean by reordering the menu...?
> >
> > David Huyck
> > [EMAIL PROTECTED]
> >
> > ------------------------------------------------------------------
> > ----------
> > --
> > To Unsubscribe visit
> >
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> the body.
>
> ------------------------------------------------------------------
> ------------
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fu
sebox or send a message to [EMAIL PROTECTED] with
'unsubscribe' in the body.
----------------------------------------------------------------------------
--
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.