开发者

how to populate a javascript array from a Notes dropdown field

i have a notes dropdown field. i need to get its 'options' list to create an array in j开发者_Python百科avascript.


If your dropdown field's value list is being computed in a Domino formula (like a DBColumn or DBLookup), then you can build the javascript array the same way, using an approach like this:

On your form, add the following - all set as pass-through HTML:

<script>
var arValues, i;
i=0;
[COMPUTED-FIELD]
</script>

Add a computed field, set to be pass-through HTML and set with a multi-value separator of newline. Have computed field have a formula something like:

list:=@DBLookup (""; ""; ...)
@if(@iserror(list); ""; ("arValues[i++]='" + list) + '';");

The result should be soemthing written back to the browser like:

<script>
var arValues, i;
i=0;
arValues[i++]='VAL 1';
arValues[i++]='VAL 2';
...
</script>

You could also do this from Javascript client-side instead. Be sure to give the dropdown an ID in Domino (on html tab), then in Javascript, document.getElementById("YOUR_DROPDOWN_ID").options will be an array of objects, each with a "value" and "text" property. Depending on what you need, just use that, or run through the elements, grab each value and build your own new array.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜