Expand my Community achievements bar.

SOLVED

Check Box makes field visible AND mandatory

Avatar

Level 2

I am using the "change" event script and it looks like this:

if (this.rawValue == "1") {
  form1.MainPage.MTAIn.MTA-INFundingSubform.MTA-INFundingCheckSub.MTA-INIndSponsTF.mandatory = "error";
  form1.MainPage.MTAIn.MTA-INFundingSubform.MTA-INFundingCheckSub.MTA-INIndSponsTF.presence = "visible";
}
else {
  form1.MainPage.MTAIn.MTA-INFundingSubform.MTA-INFundingCheckSub.MTA-INIndSponsTF.mandatory = "disabled";
  form1.MainPage.MTAIn.MTA-INFundingSubform.MTA-INFundingCheckSub.MTA-INIndSponsTF.presence = "hidden";
}

Is there something I am doing wrong? This script will not seem to change anything. The field stays hidden and optional.

I am saving this as a Dynamic pdf. Anyone have a solution?

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

The objects .rawValue is not available yet when the change event fires.

I would move the script as is to the exit event. At that stage the new value is set and this.rawValue will work.

If you want to stay with the change event, you will need to test against xfa.event.newText:

if (xfa.event.newText == "1") {

     // etc.

You are also using absolute references from the object with the script TO the NIndSponsTF object. It is likely that you don't need such a full reference and you should shorten it down to a relative reference.

Hope that helps,

Niall

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Hi,

The objects .rawValue is not available yet when the change event fires.

I would move the script as is to the exit event. At that stage the new value is set and this.rawValue will work.

If you want to stay with the change event, you will need to test against xfa.event.newText:

if (xfa.event.newText == "1") {

     // etc.

You are also using absolute references from the object with the script TO the NIndSponsTF object. It is likely that you don't need such a full reference and you should shorten it down to a relative reference.

Hope that helps,

Niall