on 06-25-2008 6:38 AM
Hi,
Can i know how to change the Button Caption using script?
Thanks
Gopal
Gopal,
This is possible using Formcalc. Let's say if you have a button field named "Button1" the use the following code to change its caption:-
Button1.caption.value.#text = "<Put Text you want here>"
Chintan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Gopal,
You have changed your intial question. Anyways this is possible too. Try this code in JavaScript :-
xfa.host.messageBox(Button1.resolveNode("Button1.caption.value.#text").value)
Also one more thing how does it matter if you get the result in Formcalc or JavaScript as long as you get it
Chintan
Hi,
Thanks for You Answers
Thanks
Gopal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I need both in Javascript
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Gopal,
Yes you are correct we cannot have a mix of Formcalc & JS ;-).
Here is the code you need though.
// Set the Button Caption
Button1.resolveNode("Button1.caption.value.#text").value = "Chintan";
// Display the Button caption in an alert.
xfa.host.messageBox(Button1.resolveNode("Button1.caption.value.#text").value);
Chintan
Hello Chintan,
Thanks for your solution. it works.
But I would like to install this code in a loop. The following Scpript doesn't work. where does I make mistake ?
var fields = xfa.resolveNodes("data.positions.Tabelle[*].TEST ");
var fields1 = xfa.resolveNodes("data.positions.Tabelle[*].TEST1 ");
for (var i=0; i <= fields.length-1; i++) {
if (fields.item(i).rawValue == null)
{
fields.item(i).presence = "hidden";
}else {
fields.item(i).presence = "visible";
if (fields1.item(i).rawValue == null)
{
fields1.item(i).presence = "hidden";
fields.item(i).resolveNode("fields.item(i).caption.value.#text").value = "TEST";
}else { fields1.item(i).presence = "visible";
fields.item(i).resolveNode("fields.item(i).caption.value.#text").value = "TEST1";
}
}
}
Edited by: Heidi Heinzberger on Mar 10, 2011 4:58 PM
Edited by: Heidi Heinzberger on Mar 10, 2011 4:58 PM
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.