you have a select field in your page, it looks like <select name="something" id="yourSelectFieldId"><option value="foo"><bar></option></select> now you get a reference to it using var myField = document.getElementById('yourSelectFieldId'); then you need to create an instance of Bs_FormFieldSelect (only one for all select fields). s = new Bs_FormFieldSelect(); and then you give your select form field the functionality of the bs class: s.init(myField); that's it, now you can use things like: myField.getValue(), myField.hasValue() etc
naming: while we usually call the elements of a hash table key and value, for the html select field they are called value and text. so key=value and value=text. might be a bit confusing.
returns the value, or, if not specified, the text.
an option tag can be written as <option>foo</option> or <option value="foo">foo</option>. if submitted to the server, it does not matter. but in js it does, for example ie6 thinks the first one has no value. the browser thinks that <option>foo</option> and <option value="">foo</option> both have the value "". but that is a big problem. because if submitted to the server, the first one will be submitted as "foo" while the 2nd will be submitted as "".
in other words, this method returns the same value as the browser would submit to the server.