0 Replies Latest reply on Dec 15, 2016 12:40 PM by akgrimes

    Javascript code multiple if/else statements Livecycle Designer

    akgrimes Level 1

      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.typeofrequestl ist.isNull)

      {   

      form1.pageonesubform.Topchunkpageone.agencyuseonlytable.Row3.typeofrequest.typeofrequestli st.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.typeofrequestli st.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.