Highlighted

mandatory fields not in red...

tygerfarr

29-03-2012

I am working with radio buttons in the Click event.  This is my script:

if (xfa.resolveNode("DepYes").rawValue == "1")

{

     Hidebox.IfYes.presence = "visible";

     Hidebox.Policy.presence = "visible";

     Hidebox.TypeCov.presence = "visible";

     Hidebox.CovPerson.presence = "visible";

     Hidebox.IfYes.mandatory = "enabled";

     Hidebox.Policy.mandatory = "enabled";

     Hidebox.TypeCov.mandatory = "enabled";

     Hidebox.CovPerson.mandatory = "enabled";

}

else (xfa.resolveNode("DepNo").rawValue == "2")

{

     Hidebox.IfYes.presence = "hidden";

     Hidebox.Policy.presence = "hidden";

     Hidebox.TypeCov.presence = "hidden";

     Hidebox.CovPerson.presence = "hidden";

}

but the boxes when they are visible, are not in red for mandatory and i don't know why. If i put "error" where "enabled" is, they don't show up at all but you get the "mandatory" popup.

I'm sure i'm just overlooking something... Help?

Replies

Highlighted

davidcornett

29-03-2012

I don't know how the mandatory pop-up message is coming up from you.

As far as I know, the script for required fields is:

Hidebox.ifYes.mandatory = "error";

I'm new to this too...so I could be wrong.

Highlighted

tygerfarr

30-03-2012

If i put "error" in, none of the fields become visible.

Almost like it's not executing them in the order it should.

Highlighted

bliksimpie

30-03-2012

Also new to this, but I also use the same layout as davidcornett proposal.

Hidebox.ifYes.mandatory = "error";

format to make mandatory fields with red around.

Highlighted

tygerfarr

30-03-2012

As i said before.  If i put

Hidebox.ifYes.mandatory = "error";

then

Hidebox.IfYes.presence = "visible";      this doesn't happen. 

Hidebox.IfYes.presence = "visible"; this works (making the field visible) with Hidebox.ifYes.mandatory = "enabled"; 

Hidebox.IfYes.presence = "visible"; this does not work (making the field visible) with Hidebox.ifYes.mandatory = "error";

does that make any sense?

Highlighted

Jono_Moore

02-04-2012

It should be .mandatory = "error";

You have some other scripting issues though which might be causing problems, I'm not sure.

Your if statement isn't constructed properly. The else statement isn't going to work properly - it could just be

else{

do stuff;

}

(if your radio button is just two values)

or if more values:

else if(field.rawValue == "2"){

do stuff;

}

else if(field.rawValue == "3" {

do more stuff;

}

The script should be more along the lines of:

(You don't need to use resolveNode to access the current object)

if (this.rawValue == "1") {

do stuff;

}

else if (this.rawValue == "2) {

do more stuff;

}

Highlighted

tygerfarr

02-04-2012

if (("DepYes").rawValue == "1")

{

     Hidebox.IfYes.presence = "visible";

     Hidebox.Policy.presence = "visible";

     Hidebox.TypeCov.presence = "visible";

     Hidebox.CovPerson.presence = "visible";

     Hidebox.IfYes.mandatory = "error";

     Hidebox.Policy.mandatory = "error";

     Hidebox.TypeCov.mandatory = "error";

     Hidebox.CovPerson.mandatory = "error";

          }

else (("DepNo").rawValue == "2")

{

     Hidebox.IfYes.mandatory = "disabled";

     Hidebox.Policy.mandatory = "disabled";

     Hidebox.TypeCov.mandatory = "disabled";

     Hidebox.CovPerson.mandatory = "disabled";

     Hidebox.IfYes.presence = "hidden";

     Hidebox.Policy.presence = "hidden";

     Hidebox.TypeCov.presence = "hidden";

     Hidebox.CovPerson.presence = "hidden";

}

This is what i put in the Change and then Click events on the Exclusion Group of radio buttons.  Now my hidden boxes don't even come up and no mandatory pop ups anywhere.

if (xfa.resolveNode("DepYes").rawValue == "1")

{

     Hidebox.IfYes.presence = "visible";

     Hidebox.Policy.presence = "visible";

     Hidebox.TypeCov.presence = "visible";

     Hidebox.CovPerson.presence = "visible";

     Hidebox.IfYes.mandatory = "error";

     Hidebox.Policy.mandatory = "error";

     Hidebox.TypeCov.mandatory = "error";

     Hidebox.CovPerson.mandatory = "error";

          }

else

{

     Hidebox.IfYes.mandatory = "disabled";

     Hidebox.Policy.mandatory = "disabled";

     Hidebox.TypeCov.mandatory = "disabled";

     Hidebox.CovPerson.mandatory = "disabled";

     Hidebox.IfYes.presence = "hidden";

     Hidebox.Policy.presence = "hidden";

     Hidebox.TypeCov.presence = "hidden";

     Hidebox.CovPerson.presence = "hidden";

}

This works with the popups, but only once and i can't change the pop up that it shows.  This is in the change event of Exclusion Group radio buttons.

As the old saying goes "it's not rocket science or none of us could do it."    There probably is a really simple mistake i'm making, i'm just not fluent enough to know what it is. 

Highlighted

Jono_Moore

02-04-2012

I think that your if statement is still messing things up. The values for an exclusion group are on the group not on the individual buttons - it looks like you are trying to query the value for a specific radio button called DepYes.

So try changing

if (xfa.resolveNode("DepYes").rawValue == "1")


to

if (this.rawValue == "1")

As long as your script is on the exclusion group itself I think it should be working (no scripts on the individual radio buttons). Other than that it looks fine as long as the path to "Hidebox" is correct.