Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Javascript code multiple if/else statements Livecycle Designer

Level 3
Level 3

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


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


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

//and so on


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


0 Replies