I have a "Lock All Fields" button set up and it's set to run only if certain fields are completed. The code works fine... except TextField13 does not validate properly. TextField13 is wrapped within a subform entitled busjus. The busjus subform is hidden from the form layout by default (it only becomes visible if a user selects certain text from a dropdown list). I want the code to check if TextField13 is null only if the busjus subform is visible.
The problematic part of the code that is not working as intended is listed below:
partiv.nonflow.busjus.presence == visible) && partiv.nonflow.busjus.TextField13 == null ||
Full code is listed below:
if(partiandii.parti.TextField2.rawValue == null ||
partiandii.parti.TextField1.rawValue == null ||
partiandii.parti.DropDownList5.rawValue == null ||
//Part II: Current Job Details
partiv.nonflow.busjus.presence == visible) && partiv.nonflow.busjus.TextField13 == null ||
partiandii.partii.NumericField2.rawValue == null ||)
{
app.alert('Please complete all fields marked with a red asterisk and try clicking the button again.');
}
else {
myScriptObject.LockAllFields(form1);
}
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
At a quick look I think this piece needs to include the rawValue call
partiv.nonflow.busjus.TextField13
this should be
partiv.nonflow.busjus.TextField13.rawValue
so that you are comparing the text in the field rather than the actual field object.
Hope this helps
Malcolm
Views
Replies
Total Likes
Hi,
Unless you have defined a variable called visible with a value of "visible" I think you will need to put visible in quotes. There also seems to be a problem with an extra bracket after visible and an extra "II" or operator at the end. So in Designer try the "Check script syntax" option under the tools menu. Also you should have the option set in Reader/Acrobat to show the console when a syntax error is displayed.
So try this;
if(partiandii.parti.TextField2.rawValue == null ||
partiandii.parti.TextField1.rawValue == null ||
partiandii.parti.DropDownList5.rawValue == null ||
//Part II: Current Job Details
partiv.nonflow.busjus.presence == "visible" && partiv.nonflow.busjus.TextField13 == null ||
partiandii.partii.NumericField2.rawValue == null)
{
app.alert('Please complete all fields marked with a red asterisk and try clicking the button again.');
}
else
{
myScriptObject.LockAllFields(form1);
}
Good luck
Bruce
Still not working..
I've got rid of all the other variables to narrow down this piece of code:
if(partiv.nonflow.busjus.presence == "visible" && partiv.nonflow.busjus.TextField13 == null)
{
app.alert('Please complete all fields marked with a red asterisk and try clicking the button again.');
}
else {
myScriptObject.LockAllFields(form1);
}
The above code (attached to a button's click event) locks all the input fields as it should, however if the TextField13 box is visible and empty, it still doesn't check to see if there is text in the field and all the fields on the form lock anyway...
There are no errors in my code when I click "check syntax."
Views
Replies
Total Likes
Hi,
At a quick look I think this piece needs to include the rawValue call
partiv.nonflow.busjus.TextField13
this should be
partiv.nonflow.busjus.TextField13.rawValue
so that you are comparing the text in the field rather than the actual field object.
Hope this helps
Malcolm
Views
Replies
Total Likes
Thanks so much Barlae! I can't believe I didn't notice I was missing the rawValue... I've been working on this form way too much in the past couple of days!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies