Expand my Community achievements bar.

SOLVED

If Statement help

Avatar

Level 4

I have the if statement below that will works just with way I want it to, if the button is click and the Portfoliocode is null the border and fill color turns red and the "Please complete all required fields to print." message appears the once the PortoflioCode has something in it the border and fill colors turn back white and document prints.

This assistance I need is, there are 4 more fields that need to operate the same way under the same button when clicked. So if either one of these are left blank the blank one would turn red and once the blank ones are filled they will turn back white and the document will print.

if ((form1.FundRequest.PcCn.PortfolioCode.rawValue == null)) then

FundRequest.PcCn.PortfolioCode.border.fill.color.value = "255,0,0"

xfa.host.messageBox("Please complete all required fields to print.")

else

FundRequest.PcCn.PortfolioCode.border.fill.color.value = "255,255,255"

form1.#pageSet[0].Page1.PrintButton1.execEvent("click")

endif

Thank you for any assistance

Parre

1 Accepted Solution

Avatar

Correct answer by
Level 10

HI Parre,

If I understand correctly this should do what you want;

var valid = 1;

  1. FundRequest.PcCn.PortfolioCode.border.fill.color.value = "255,255,255"
  2. FundRequest.PcCn.PortfolioCode1.border.fill.color.value = "255,255,255"
  3. FundRequest.PcCn.PortfolioCode2.border.fill.color.value = "255,255,255"
  4. FundRequest.PcCn.PortfolioCode3.border.fill.color.value = "255,255,255"

if ((form1.FundRequest.PcCn.PortfolioCode.rawValue == null)) then

    FundRequest.PcCn.PortfolioCode.border.fill.color.value = "255,0,0"

    valid = 0;

endif

if ((form1.FundRequest.PcCn.PortfolioCode1.rawValue == null)) then

    FundRequest.PcCn.PortfolioCode1.border.fill.color.value = "255,0,0"

    valid = 0;

endif

if ((form1.FundRequest.PcCn.PortfolioCode2.rawValue == null)) then

    FundRequest.PcCn.PortfolioCode2.border.fill.color.value = "255,0,0"

    valid = 0;

endif

if ((form1.FundRequest.PcCn.PortfolioCode3.rawValue == null)) then

    FundRequest.PcCn.PortfolioCode3.border.fill.color.value = "255,0,0"

    valid = 0;

endif

if (valid) then

    form1.#pageSet[0].Page1.PrintButton1.execEvent("click")

else

    xfa.host.messageBox("Please complete all required fields to print.")

endif

This assumes your other three fields are called PortfolioCode1, PortfolioCode2, and PortfolioCode3

Hope this helps

Bruce

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

HI Parre,

If I understand correctly this should do what you want;

var valid = 1;

  1. FundRequest.PcCn.PortfolioCode.border.fill.color.value = "255,255,255"
  2. FundRequest.PcCn.PortfolioCode1.border.fill.color.value = "255,255,255"
  3. FundRequest.PcCn.PortfolioCode2.border.fill.color.value = "255,255,255"
  4. FundRequest.PcCn.PortfolioCode3.border.fill.color.value = "255,255,255"

if ((form1.FundRequest.PcCn.PortfolioCode.rawValue == null)) then

    FundRequest.PcCn.PortfolioCode.border.fill.color.value = "255,0,0"

    valid = 0;

endif

if ((form1.FundRequest.PcCn.PortfolioCode1.rawValue == null)) then

    FundRequest.PcCn.PortfolioCode1.border.fill.color.value = "255,0,0"

    valid = 0;

endif

if ((form1.FundRequest.PcCn.PortfolioCode2.rawValue == null)) then

    FundRequest.PcCn.PortfolioCode2.border.fill.color.value = "255,0,0"

    valid = 0;

endif

if ((form1.FundRequest.PcCn.PortfolioCode3.rawValue == null)) then

    FundRequest.PcCn.PortfolioCode3.border.fill.color.value = "255,0,0"

    valid = 0;

endif

if (valid) then

    form1.#pageSet[0].Page1.PrintButton1.execEvent("click")

else

    xfa.host.messageBox("Please complete all required fields to print.")

endif

This assumes your other three fields are called PortfolioCode1, PortfolioCode2, and PortfolioCode3

Hope this helps

Bruce

Avatar

Level 4

Thanks Bruce,

This is just what I wanted.  Thank you so much for your help!!!

Parre