I have a LiveCycle Form with a repeating subform where the first field (text field 2 characters) requires the input of a code between 01 and 99. Can you script so that you cannot enter the same code value more than once?
Solved! Go to Solution.
Views
Replies
Total Likes
Here is some code in Formcalc which will work for what you want. Put it in the exit event for the textfield.
In this example the page is called myPage and the textField is called TextField1. Rename them as you need.
var indexCount = 0
var thisIndex = $.parent.index
while (indexCount < thisIndex) do
if (myPage[indexCount].TextField1 == myPage[thisIndex].TextField1) then
xfa.host.messageBox("You have already used that number")
$ = ""
endif
indexCount = indexCount + 1
endwhile
Views
Replies
Total Likes
You could loop through all instances checking their value.
Views
Replies
Total Likes
Are you aware of any sources where I can view the javascript code for such a loop? Got some books on Javascript but they all relate to web scripting - have not seen any that relate to LiveCycle/Acrobat.
Views
Replies
Total Likes
Here is some code in Formcalc which will work for what you want. Put it in the exit event for the textfield.
In this example the page is called myPage and the textField is called TextField1. Rename them as you need.
var indexCount = 0
var thisIndex = $.parent.index
while (indexCount < thisIndex) do
if (myPage[indexCount].TextField1 == myPage[thisIndex].TextField1) then
xfa.host.messageBox("You have already used that number")
$ = ""
endif
indexCount = indexCount + 1
endwhile
Views
Replies
Total Likes
Thank you for your help, just what I wanted it to do.
Views
Replies
Total Likes
Documentation on JavaScript that is meant for use in a browser is still useful. The syntax is the same. The difference are in the objects that you call things on. Browser JavaScript has a default object of window. So alert("Test") is really window.alert("Test"). In Designer, you would need to use app.alert("Test"). If you needed to say modify a string, here would be a good place to get info: http://w3schools.com/js/default.asp
Views
Replies
Total Likes
Thanks again. I have very little experience with scripting or programming, so your comments are very helpful in giving me a focus on the subject. I have designed Forms for years in InDesign and saved as PDFs for writing up. See the advantages that Livecycle offers but am struggling with scripting.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies