Page 2 of 2
Re: Create simple multiple option list which displays predefined
Posted: Mon Sep 21, 2009 5:47 am
by ianpow
Nope, no error message and nothing else on screen. You click the button and nothing happens, nothing at all. Not even the yellow bar asking to allow scripts to run etc.......

Re: Create simple multiple option list which displays predefined
Posted: Mon Sep 21, 2009 7:18 am
by jackpf
Hmm...I'm at college atm. I'll check it out when I get home though.
Re: Create simple multiple option list which displays predefined
Posted: Mon Sep 21, 2009 11:31 am
by jackpf
Omg...that was so stupid. <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> IE. There was an error message btw. Down in the left hand corner, that yellow warning symbol...
Apparently it doesn't like commas at the end of structs. For example:
Code: Select all
var foo = { a: 'someproprty', b: 'anotherone', //this comma is not allowed for some reason};
So yeah, here's the fixed code.
Code: Select all
<script> var display = { text: { a: 'you selected a', b: 'you selected b', c: 'you selected c' }, options: new Array(), update: function() { var options = document.forms['formid'].selectName.options; this.options = new Array(); for(var i = 0; i < options.length; i++) { if(options[i].selected) { this.options[this.options.length] = this.text[options[i].value]; } } var _display = document.getElementById('display'); _display.innerHTML = ''; for(i = 0; i < this.options.length; i++) { _display.innerHTML += this.options[i]+'<br />'; } } }</script> <form id="formid"> <select name="selectName" multiple="true"> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> </select> <input type="button" onclick="display.update();" value="blah" /></form> <div id="display"></div>
Re: Create simple multiple option list which displays predefined
Posted: Mon Sep 21, 2009 5:57 pm
by ianpow
Jack, pure genius! I made the changes you recommended and its working perfectly. Also used the wc3 validator to sort out some other cross browser issues and now it rocks!
Post your email address and i will connect so I can send you out some goody bag from the office -same goes for you Ollie.
btw, if you do this kind of thing at college then I can send you details of the full project this is part of, ppt's etc so you can show real world commercial applications of your work (we operate in over 50 countries wordwide) As a forum we have created something, which although relatively simple on the surface, will make a significant difference to the way a major corporate project delivers and the effectiveness with which over 1500 sales reps will execute new company strategy. And best of all - this was only done in only 3 days!

Re: Create simple multiple option list which displays predefined
Posted: Tue Sep 22, 2009 4:44 am
by jackpf
Lool..internet goodies...I'm sceptical

But there should be an "envelope" icon next to my username you can use to email me.
Nah, I don't learn this stuff at college. I learned C++, PHP & javascript in my spare time. At college I learn Delhpi :/ Only cause they make me though.
As a forum we have created something, which although relatively simple on the surface, will make a significant difference to the way a major corporate project delivers and the effectiveness with which over 1500 sales reps will execute new company strategy. And best of all - this was only done in only 3 days!
Glad I could help
