If-else syntax for conditional fields

20 views
Skip to first unread message

Alex

unread,
Jul 17, 2011, 5:39:32 PM7/17/11
to CenoPDF Support Group
Hi Yang,
I need your help another time.

I want this behaviour:

when field t1 = "1"
field t2 = "a";

when field t1 = "2"
field t2 = "b";

when field t1 = "3"
field t2 = "c";

when field t1 = "4"
field t2 = "d";

when field t1 = empty (no text inside)
field t2 = "insert text".

Thank you for all,
Alex

Yang Lu

unread,
Jul 17, 2011, 5:48:59 PM7/17/11
to cenos...@googlegroups.com
Hi Alex,

You can put the following code in t1's On Blur handler:

var t1 = this.getField("t1name");
var t2 = this.getField("t2name");

if(t1.valueAsString == "1")
{
t2.value = "a";
}
else if(t1.valueAsString == "2")
{
t2.value = "b";
}
else if(t1.valueAsString == "3")
{
t2.value = "c";
}
else if(t1.valueAsString == "4")
{
t2.value = "c";
}
else
{
t2.value = "insert text";
}

I have not test above code but I believe it should work. Let me know how it
goes.

Thanks,
Yang

I want this behaviour:

--
You received this message because you are subscribed to the Google Groups
"CenoPDF Support Group" group.
To post to this group, send email to cenos...@googlegroups.com.
To unsubscribe from this group, send email to
cenosupport...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/cenosupport?hl=en.


Alex

unread,
Jul 18, 2011, 8:53:37 AM7/18/11
to CenoPDF Support Group
Perfect.

Thanks
Reply all
Reply to author
Forward
0 new messages