How to make web users confirm their selections in multi-value keywords?

Author: Tripp W Black

Created: 08/26/1999 at 07:51 PM

 

Category:
Notes Developer Tips
Forms/Subforms, LotusScript

There are serveral points to note in your request.

1) How do I determine what has been selected in a Select object?
Javascript will be needed to scroll through the Select object to see which option's
'selected' property is set to 'true'. This script can be activated using the 'onChange' event.
Use the HTML

2) How do I show what has been selected?
You will need another field to display what has been selected. You may want to disable
this field.

Example:
IN NOTES
1) Place "onChange=\"showSelections()\"" in <HTML Attributes> for your
keyword field (e.g., myKeyword).
2) Place a new field (e.g., myfield) with "disabled" in <HTML Attributes>.

JAVASCRIPT
<SCRIPT>
<!--
function showSelections() {
var cnt=0;
document.forms[0].myfield.value="";
for (x=1; x < document.forms[0].myKeyword.length ; x++ ) {
if ( document.forms[0].myKeyword.options[x-1].selected = true )
{
If (cnt>0) {
document.forms[0].myfield.value=
document.forms[0].myfield.value + ", " +
document.forms[0].myKeyword.options[x-1].text;
}
else {
document.forms[0].myfield.value=
document.forms[0].myfield.value +
document.forms[0].myKeyword.options[x-1].text;
}
}
}
}
-->
</SCRIPT>


previous page