In javascript, you need the value property to be lowercase, for example:
document.getElementById('assignedIDHiddenInput').value = s;
Then it will be installed correctly :) Here you can see an example
Although if you tell .Value it will show your value, you really added the new .Value property, but you did not set the input property .Value , which is sent to the server. The link example above illustrates this both ways.
You can also do this a little faster, especially if you have many options, using an array instead of concatenating strings, for example:
var source = document.getElementById('assignedLinguistListBox'); var opts = []; for (var i = 0; i < source.options.length; i++) { opts.push(source.options[i].value); } var s = opts.join(',');
Edit: The above code has been updated, CMS is right that the previous method was browser dependent, the above should now behave sequentially. Also, if jQuery is an option, there are shorter ways to get this information, for example:
var s = $('#assignedLinguistListBox option').map(function() { return this.value; }).get().join(','); $('#assignedIDHiddenInput').val(s);
You can see a working example of this here.
Nick craver
source share