Question

How can I change the caption of a button using LotusScript/Formula?

Was it helpful?

Solution

What Ken says is true, but you can change button labels using JavaScript in the Notes client. You'll need to go to the <HTML> tab of the button properties and give the button a name value (an id value works as well in later versions), then you can use

document.forms[0].ButtonHTMLName.value = "New Caption";

or

document.forms[0].elements["ButtonHTMLName"].value = "New Caption";

Either can be triggered from any number of client events in Notes version 6 or higher using client-side or common JavaScript.

OTHER TIPS

There are no hooks into a button that will let you change it via LotusScript or a Formula. If you only have a few different captions you'd like to have on a button (and the scripts are the same), I've once stored those various predefined buttons on a hidden form, in separate richtext items, and then copied them to my doc using LotusScript. That would be useful if you were trying to generate and send a button in an email for example, but not much use unless you're generating the doc upon which the button appears programmatically as well.

You might find useful the undocumented method "addLinkByIDs" on the NotesRichTextItem class. Again, probably only useful if you're building the document on the fly, as changing rich text items on a UI doc isn't very easy to do.

More info on undocumented methods here: http://opendom.blogspot.com/2006/11/undocumented-dom-lotusscript-inventory.html

Lastly, there's always the Midas LSX from GeniiSoft, which is an add-on that gives you lots of control over rich text items. I don't know for sure, but I'd bet there's a way to change a button caption using that LSX. http://www.geniisoft.com/showcase.nsf/MidasLSX

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top