User Profile
Collapse
-
Thanks so much for sticking with me on this. Your code got rid of the some of the extraneous stuff, and works properly! Thanks again for the help. -
You're right: messy code! How about this? It tests fine inside Livecycle ...
On change*
if (xfa.this.chang e!="" && !xfa.event.newT ext.match(/^[1-9][0-9]?$|^100|^(n|r|i )$/)){
xfa.event.chang e ="";
xfa.host.messag eBox("Incorrect entry.. also, n outputs NA. Thanks!");
}
On exit*
this.rawValue=t his.rawValue.re place(/n/g,"NA")...Leave a comment:
-
Hello Rabbit,
I've amended the regex for the number entry:
//Test input in real time. Only allow approved grades, r, i, na
if (xfa.this.chang e!="" && !xfa.event.newT ext.match(/^[1-9][0-9]?$|^100|^(n?)?$ |^(r)?$|^(i)?$/)){
xfa.event.chang e ="";
xfa.host.messag eBox("Incorrect entry.. also, n outputs NA. Thanks!");
}
On exit*
this.rawValue=t his.rawValue.re place(/n/g,"NA")...Leave a comment:
-
How does this look? (I'm still getting an error when i input three digits like "560:...)
On change*
//Test input in real time. Only allow approved grades, r, i, na
if (xfa.this.chang e!="" && !xfa.event.newT ext.match(/^([1-9]{1,2}[0]?|100+|n|r|i)$/)) {
xfa.event.chang e ="";
xfa.host.messag eBox("Incorrect entry.. also, n outputs NA. Thanks!");
}
...Leave a comment:
-
OK, good idea! But where do I find post #16. I looked, I promise!Leave a comment:
-
I have decided to work with this approach for what I need to accomplish:
On change*
// Test input in real time. Only allow approved grades, r, i, n with the code on exit replacing n with na
if (xfa.event.chan ge!="" && !xfa.event.newT ext.match(/^[0-9]+?$|^(^n?)?$|^( r)?$|^(i)?$/)) {
xfa.event.chang e ="";
xfa.host.messag eBox("Oops, incorrect entry, Please correct your...Leave a comment:
-
The field length is limited to a maximum of three characters, so that isn't a problem. But I see what you mean with entering n on change using your script. Could you resend your script to show that the digits are limited to only the values of 0 to 100 (like grades on a report card?) I'll keep at it ...Leave a comment:
-
Thank you ... I've tried the code and I can make entries for any number values that are three digits, or I can enter the value "r" or I can enter the value "i".
These are all good, but now I can't successfully enter the value "na". Do you have a suggestion for how i can do this successfully, and also without running into the problem where either the "n" or "a" values can be entered separately...Leave a comment:
-
Sorry about that ... would you mind sending along the code as you suggested? I know I'm missing something here...Leave a comment:
-
Thanks for continuing to stick with me! Output values should be restricted to:
either a number
OR
the value of "r"
OR
the value of "i"
OR
the value of "na"
So no combined values, just the very specific options as above. Do you mind having another look?Leave a comment:
-
Here is the revised script I am trying on your suggestion:
On change*
// Test input in real time. Only allow approved grades, r, i, na
if (xfa.event.chan ge!="" && !xfa.event.newT ext.match (/^[0-9]+(na|r|i)$/)) {
xfa.event.chang e ="";
xfa.host.messag eBox("Oops, incorrect entry, or caps lock are on. Thank you.");
}Leave a comment:
-
When i change the script as per above, I can get the numerals, but no other entries. Only numerals are to be allowed, OR any of the three options, but not both.Leave a comment:
-
I'm working in livecycle designer es4. I want to limit the entry to the following options: any numerals 1-100; and then three entries only: the value "na", the value "r" or the value "i".
This is on the change event. Everything works except that the "i" value also accepts "ir"
This is the script that works with the exception as noted above:
if (xfa.event.chan ge!=""...Leave a comment:
-
how do i limit user choice to three options?
I have a field that allows entries of 1 to 100, or the value "r" or the value "i" or the value "na"
My script looks like this, but it continues to allow duplicate entries of the "i" and the "r" when the
"i" is entered on the change* event. What is missing?
if (xfa.event.chan ge!="" && !xfa.event.newT ext.match(/^[0-9]+(\+|-)?$|^(na?)?$|^( r)?$|^(i)/))...
No activity results to display
Show More
Leave a comment: