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

Javascript code for multiple if/else conditions in Livecycle Designer

Participant ,
Dec 15, 2016 Dec 15, 2016

I'm trying to code a button that will check several mandatory fields and individually highlight them in red if they aren't completed. I do not want to use a submit button.

I can get the code to work for my first field:

if ( form1.pageonesubform.Topchunkpageone.agencyuseonlytable.Row3.typeofrequest.typeofrequestlist.isNull)

{   

form1.pageonesubform.Topchunkpageone.agencyuseonlytable.Row3.typeofrequest.typeofrequestlist.border.fill.color.value = "255,0,0";     xfa.host.messageBox("Some fields are empty. Please scroll up and complete fields highlighted in red.");    

}

else {

form1.pageonesubform.Topchunkpageone.agencyuseonlytable.Row3.typeofrequest.typeofrequestlist.border.fill.color.value = "255,255,255"; 

}

But where do I put code for the next if/else? When I set up the exact same code with the next field name under the above if/else code, nothing at all happens -- the first action doesn't even happen. But if I make it "or" with ||, then it will only highlight one field -- the first one.

I need it to do this:

If typeofrequestlist is empty, turn it red, once filled, turn it white

AND

If supvname is empty, turn it red, once filled turn it white

AND

if supvclass is empty, turn it red, once filled turn it white

//and so on

then

If all fields are filled, show message box "All mandatory fields have been completed."

HELP.

TOPICS
Acrobat SDK and JavaScript
282
Translate
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
no replies

Have something to add?

Join the conversation