Morning Morningz, > Why wouldn't you just have > > <select name="customer" id="customer"> > <option value="50ccdae0-79bf-11dd-ad8b-0800200c9a66">Joe > Bloggs</option> > <option value="9c335820-d878-4db3-b90a-728046cb8849">Dave > Something</option> > </select> > > <a id="CompanyLink"></a> > > > <script type="text/javascript"> > $(document).ready(function() { > $("#customer").change(SetLink); > SetLink(); > }); > function SetLink() { > var obj = document.getElementById("#customer"); > obj = obj.options[obj.selectedIndex]; > $("#CompanyLink") > .attr("href", '/view_customer_company.cfm?company_id=' > + obj.value) > .html('View ' + obj.text + ' Company'); > } > </script> > > deeming the key/value lookup unnecessary?
The reason I can't do this is because the 9c335820-d878-4db3-b90a-728046cb8849 isn't the ID of the customer which is ultimately what I need when I submit the form, so this has to stay as the numeric ID value. The link which changes is just a usability thing to allow my users to quickly check the background of the customer before they submit the form, but to check the background I need their company_id, which is why we need the key:value pair. Is the key:value pair complicated to implement into your above example? I understand the code you've provided but wouldn't really know where to start enhancing it. Thanks for your advice mate, I appreciate it. Robert