Copy link to clipboard
Copied
On the preprint event of my LiveCycle Designer (9.0.0.2) form I have a Java if statement that checks if textboxes are null.
I want to check a textbox to see if it has a folder path entered eg. \\network1\Public\InBox\.
But I'm hitting a brick wall with my If statement...
Please help
You want \\
Each \ has to be preceded by a backslash
That isn't what you did, you only have three.
This is not specific to Acrobat, but to JavaScript and all the C-like languages. See JavaScript Strings
Copy link to clipboard
Copied
You have to escape all the back-slashes, by adding a back-slash before them.
Copy link to clipboard
Copied
I tried: "\\\network1\\Public\\InBox\\" and 'Check Script Syntax' seems to like it - because there is no more pink line highlighting it.
But! it fails to fire the app.alert, xfa.cancelAction, and xfa.host.setfocus actions.
Is my syntax legit?
Copy link to clipboard
Copied
Is there another forum I can ask this question?
Copy link to clipboard
Copied
This is a better place for it, actually: LiveCycle Designer
Copy link to clipboard
Copied
The value of the File Location textbox needs to be \\network1\Public\InBox\somefolder\
Is there a better way I can test the value of the textbox?
Copy link to clipboard
Copied
You want \\
Each \ has to be preceded by a backslash
That isn't what you did, you only have three.
This is not specific to Acrobat, but to JavaScript and all the C-like languages. See JavaScript Strings
Copy link to clipboard
Copied
this is the code that worked for me...
if (NewRequestForm.Page1.Requester.rawValue == null){
app.alert("Requester Cannot be Blank.", 3);
xfa.event.cancelAction = 1;
xfa.host.setFocus("NewRequestForm.Page1.Requester");
} else if (NewRequestForm.Page1.ProjectManager.rawValue == null){
app.alert("Project Manager Cannot be Blank.", 3);
xfa.event.cancelAction = 1;
xfa.host.setFocus("NewRequestForm.Page1.ProjectManager");
} else if (NewRequestForm.Page1.Requester.rawValue == NewRequestForm.Page1.ProjectManager.rawValue){
app.alert("Requester Cannot be the Same As Project Manager.");
xfa.event.cancelAction = 1;
xfa.host.setFocus("NewRequestForm.Page1.Requester");
} else if (NewRequestForm.Page1.FileLocation.rawValue == null){
app.alert("File/Image Location Cannot be Blank.", 3);
xfa.event.cancelAction = 1;
xfa.host.setFocus("NewMoldRequestForm.Page1.FileLocation");
} else if (NewRequestForm.Page1.FileLocation.rawValue == "\\\\network1\\Public\\InBox\\"){
app.alert("File Location Must be a Valid Folder Location on \\network1.", 3);
xfa.event.cancelAction = 1;
xfa.host.setFocus("NewRequestForm.Page1.FileLocation");
}