How it works
This javascript code presents to the user a button. The button, takes a new value from the user and then sets the pulldown value to be that value. Simple.
The added benefit is that the button can be hidden from certain users, to allow only "Power Users" to be able to add new categories for example.
REM "This code allows another value to be specified on a pull down field on the web browser.";
REM "This code should be placed in a Computed Text element with Pass-Thru HTML ticked";
REM "Replace Name with the name of the keyword field with 'Allow other values' NOT ticked.";
REM "Code is from http://www.NotesNinjas.com/#JSOther";
REM "If not edit mode then do nothing";
@if( @isdocbeingedited=0;@return("");"");
"<input type=\'button\' value=\'Other\' onclick=\"val = prompt(\'Enter New Value:\', \'\'); if(val==\'\' || val==null) {alert(\'Enter a value!\'); return false;} else { "+
"var categoryfield = window.document.forms[0].Name;"+
"var newindex = categoryfield.length;"+
"categoryfield.length = newindex + 1;"+
"categoryfield.options[newindex].text = val;"+
"categoryfield.value = val;"+
"categoryfield.options[newindex].selected = true;}"+
" return false;\">"
One problem with this code has been found:
If you have refresh fields on keyword change and you have already selected a 'Other' value the form's fields will be reset to default values. This is because Notes R5.07 and above has changed how the server deals with forms that have had their field's choices changed. The form is now reloaded.
Very annoying. So don't use "refresh fields on keyword change" on any fields on any forms using this code.