Hi all, hoping you can help me again with a query. I'm using LiveCycle Designer ES2.
I have a text field on my form - let's say Account Number - that has a validation pattern of text{AA999}|text{99999} i.e it must be a 5 character string, either two letters and three numbers or 5 numbers. This is set in the Validation Pattern GUI, not in script.
What I'd like to do is control the visibility of another field - let's say Account Name - based on whether Account Number validates correctly or not. I know how to write the script to control the visibility, but not sure what test to do for it. Something like...
if (<<how do I write the test to see if it validated correctly?>> == true)
{
AccountName.visibility = "visible";
}
else
{
AccountName.visibility = "hidden";
}
Can anyone guide me as to how to do this?
Thanks
Matt
Solved! Go to Solution.
Views
Replies
Total Likes
if you call the validate method of the object it will return a true or false based on whether teh validation passed or failed.
So your code would look something like this:
if (fieldName.execValidate() == true)
{
AccountName.visibility = "visible";
}
else
{
AccountName.visibility = "hidden";
}
Views
Replies
Total Likes
Using Regular Expressions is the best approach for this requirement. But you need to write a few lines of code in javascript.
Nith
if you call the validate method of the object it will return a true or false based on whether teh validation passed or failed.
So your code would look something like this:
if (fieldName.execValidate() == true)
{
AccountName.visibility = "visible";
}
else
{
AccountName.visibility = "hidden";
}
Views
Replies
Total Likes
Interesting and pretty simple solution !
Thanks Paul.
Views
Replies
Total Likes
Hi both,
Thanks for your responses - Nith yes I did think about using regular expressions but I wasn't sure of the syntax needed to check for my requirements, hence why I used the pattern editor.
Paul - thanks for your help - this works perfectly.
Matt
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies