• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

If Statement to test TextBox RawValue

New Here ,
Feb 07, 2018 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

TOPICS
Acrobat SDK and JavaScript

Views

970

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
community guidelines

correct answers 1 Correct answer

LEGEND , Feb 08, 2018 Feb 08, 2018

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

Votes

Translate

Translate
Community Expert ,
Feb 07, 2018 Feb 07, 2018

Copy link to clipboard

Copied

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

Votes

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
community guidelines
New Here ,
Feb 07, 2018 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?

Votes

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
community guidelines
New Here ,
Feb 08, 2018 Feb 08, 2018

Copy link to clipboard

Copied

Is there another forum I can ask this question?

Untitled2.jpg

Votes

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
community guidelines
Community Expert ,
Feb 08, 2018 Feb 08, 2018

Copy link to clipboard

Copied

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

Votes

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
community guidelines
New Here ,
Feb 08, 2018 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?

Votes

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
community guidelines
LEGEND ,
Feb 08, 2018 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

Votes

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
community guidelines
New Here ,
Feb 08, 2018 Feb 08, 2018

Copy link to clipboard

Copied

LATEST

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

}

Votes

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
community guidelines