Change caption for any object

1,013 views
Skip to first unread message

Jorge_Mota

unread,
Jun 12, 2008, 2:16:26 PM6/12/08
to Adobe LiveCycle Developers
Hi I am starting with LiveCycle, but I can't found a good tutorial to
get started correctly with it :(

And I have 2 controls: 1 combobox and 1 textbox. When User select
first element in combobox, textbox.caption must be "Value for 1", when
user select second element textbox.caption must be "insert your name"
for example.

I have this code in validate of combobox

var tVal = this.rawValue;
if (tVal=="1"){
banco.presence="visible";
seguridad.presence="invisible";
//this.parent.resolveNode("clabe.caption.value.#text").value="Value
for 1"; dont work
//clabe.caption.value#text.value="value for 1"; dont work
clabe.resolveNode("clabe.caption.value.#text").value ="Value for 1"
<-- dont work
}
if (tVal=="2"){
seguridad.presence="visible";
banco.presence="invisible";
//this.parent.resolveNode("clabe.caption.value.#text").value ="Insert
your name";
clabe.resolveNode("clabe.caption.value.#text").value ="Insert your
name"
}

I have "clabe" and combobo into a subform in page2 of my pdf file.
If someone can give me a link for learn how do that :)

Best regards (sorry my bad english I speak spanish)

sru...@gmail.com

unread,
Jun 13, 2008, 11:01:03 PM6/13/08
to Adobe LiveCycle Developers
Hi Jorge,

Your approach for retrieving the caption for the field is
correct, but there very minute mistakes that would have caused the
problem. let us consider that combo box is referred as DropDownList
and text field as TextField

so the code goes as here..... the three lines of code would work
independently......

if(DropDownList.rawValue == "1")
{
TextField.caption.value.text.value = "Value1";
//or
this.parent.resolveNode("TextField.caption.value.#text").value =
"Value1";
//or
TextField.resolveNode("TextField.caption.value.#text").value =
"Value1";
}
if(DropDownList.rawValue == "2")
{
TextField.caption.value.text.value = "Value2";
//or
this.parent.resolveNode("TextField.caption.value.#text").value =
"Value2";
//or
TextField.resolveNode("TextField.caption.value.#text").value =
"Value2";
}

Don forget to save the form as Dynamic PDF... this is very important
as you are changing the dynamism of the form.

Also its always better to write scripts for a combo box in its "exit"
event or "change" event as per ur requirements.. because "validate"
event is meant mainly for pattern/field validations. thus it would get
executed twice - during the field validation and also if the form gets
submitted to workflow... Hope i made myself clear... feel free to
question for any further doubts...

Would also like to note... Numerous pdf docs are available in adobe
website for download - provides lots of sample scripts and rules for
scipritng in both javascript and formcalc. Do try them and u would
feel scripting is very easy....

Ramya...

Jorge_Mota

unread,
Jun 18, 2008, 2:47:08 PM6/18/08
to Adobe LiveCycle Developers
thanks a lot :)

On 13 jun, 21:01, "sru...@gmail.com" <sru...@gmail.com> wrote:
> HiJorge,

Xabier Rivas Martinez

unread,
Jun 26, 2008, 3:07:05 AM6/26/08
to live...@googlegroups.com
I agree with Ramya, try to put that code into the event exit or change of the DropDownList. Maybe in that way the code will work well!!


Reply all
Reply to author
Forward
0 new messages