LiveCycle cheat sheet
“If it wasn’t backed-up, then it wasn’t important.”
I have just recently plunged into the “not-so-exiting” world of liveCycle. While working with the forms, we’v discovered some bugs.
this post is ment as a mental note to self, as well as a reference for those who have run into similar issues. If you have questions or comments feel free to post.
Limiting visible area on numeric fields.
There are a few ways to do this, you can:
make the field a text field, limit the visible area, or set the max # of characters and use any simple IsNumeric() javascript functions to validate the input. If you want the user to only be able to type in numeric digits, you can use the following:
{
xfa.event.change = “”;
}
you can also leave the field as a numeric and check for it’s length(this is mostly usefull if you only want to allow a small amount of digits, otherwise, you’d have to know how much the visible area holds. The example below, will only allow the user to enter 5 numeric characters.
{
xfa.event.change = “”;
}
Chaning the value of the selected item in a combo box
Now here is another issues, we’v run into a few times already. How do you make the combo box display, lets say, abbreviation or an acronym, of the value selected? You can make 2 comboboxes (one on top of the other) and hide and unhide them, depending on which value you want to show, setting the selectedIndex of the first, to the second. or ofcourse there is javascript. in this case the editValue property is used:(on exit event) ÂÂ
{
case 0:
this.editValue = “JSâ€Â
break;
case 1:
this.editValue = “BJâ€Â
break;
}
this would be used if, lets say you want the user to see “John Smith” and “Barbara Johnson” as the initial data, and change to the initials once selected.
ÂÂ
 Changing the height of field1 to height of field2
If for example, you have two fields side by side (which are NOT in a table – tables readjust automatically), and you want to keep them consistant. As the height of one field changes, so does the other, the following code needs to go under layoutReady event, of the field who’s height is changing:
field2.h = newHeight + “in”;
ÂÂ
4 Comments
Many thanks for your prompt answer.
I was suspicious, but thought Acrobat Javascript has some “built-in” functions. Because I’m new in a “not-so-exiting” world of LiveCycle (Visual Studio is my homeworld
may be my problem is to differentiate object model (acroform, XFA), language used (Javascript, FormCalc) and to find a good reference guide, where I can fix what exactly I’m programming…
hey
i usually use Javascript, seems like theres much more help for it online, but keep in mind that the LiveCicle Javascript is a bit different from the “regular” javascript – you may never end up facing this problem, i only figured it out while trying to get hte javascript prompt pop up to work, which Acrobat Javascript does not have.
Veľa šťastia
Hi,
nice post. I’m just wondering, how did you run IsNumeric() function? Because in Livecycle 8.2 I’m geting:
IsNumeric is not defined
in Change event of a text field with whatever Acrobat and Adobe Reader supported version. Am I missing something?
Thanks for your answer,
Dawid
IsNumeric is not a LC function, it’s javascript.
Google for “IsNumeric Javascript” and the world is yours
the first one that poped up, i beleive was the one i used:
{
var ValidChars = “0123456789.”;
var IsNumber=true;
var Char;
for (i = 0; i < sText.length && IsNumber == true; i++)
{
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1)
{
IsNumber = false;
}
}
return IsNumber;
}
Good Luck!