If Statement to test TextBox RawValue

New Here ,
Feb 07, 2018

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...

Capture1.JPG

Please help

Most Valuable Participant
Correct answer by Test Screen Name | Most Valuable Participant

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

TOPICS
Acrobat SDK and JavaScript

Views

447

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

If Statement to test TextBox RawValue

New Here ,
Feb 07, 2018

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...

Capture1.JPG

Please help

Most Valuable Participant
Correct answer by Test Screen Name | Most Valuable Participant

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

TOPICS
Acrobat SDK and JavaScript

Views

448

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 07, 2018 0
Most Valuable Participant ,
Feb 07, 2018

Copy link to clipboard

Copied

You have to escape all the back-slashes, by adding a back-slash before them.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 07, 2018 0
New Here ,
Feb 07, 2018

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 07, 2018 0
New Here ,
Feb 08, 2018

Copy link to clipboard

Copied

Is there another forum I can ask this question?

Untitled2.jpg

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 08, 2018 0
Most Valuable Participant ,
Feb 08, 2018

Copy link to clipboard

Copied

This is a better place for it, actually: LiveCycle Designer

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 08, 2018 0
New Here ,
Feb 08, 2018

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 08, 2018 0
Most Valuable Participant ,
Feb 08, 2018

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 08, 2018 0
New Here ,
Feb 08, 2018

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");

}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 08, 2018 0