Expand my Community achievements bar.

radio button's click event to script both ".presence" and ".mandatory" -- Need help !

Avatar

Former Community Member
Hi all,



I've adopted the script stated in HightlightOneRequiredField.pdf so that the print button in my form can detect and prevent null field before pop up the print dialog. It works fine.



In my form, I've created a mandatory 2-radio buttons group with click event script written, using ".presence", in each button. When user clicks:

Button A: make subform A visible and subform B invisible;

Button B: make subform A invisible and subform B visible.



Apart from the visibility of the subforms, what I want more is to add a .mandatory script (together with the click event) in the buttons to turn some fields' mandatory in the subforms on and off so that when user clicks:

Button A: will also turn some fields' value type in subform A to be "User

Entered-Required", whereas some of that in subform B to be "-

optional";

Button B: will turn the subform B's fields to "-Required" and subform A's

fields back to "-optional"



However no luck with me. When I press the print button after any of the radio buttons checked, the print dialog still show up even the subforms' fields are null as if those fields' value type always remain "-optional"



I wonder if this problem is caused by Chinese binding name ? The script written in the radio button B is:

-----------------------------------------------------

FormA.presence = "invisible";

FormB.presence = "visible";

if (B1.mandatory = "disabled")

{

B1.mandatory = "error";

}



if (B2.mandatory = "disabled")

{

B2.mandatory = "error";

}



if (B3.mandatory = "disabled")

{

B3.mandatory = "error";

}



if (A1.mandatory = "error")

{

A1.mandatory = "disabled";

}



if (A2.mandatory = "error")

{

A2.mandatory = "disabled";

}



if (A3.mandatory = "error")

{

A3.mandatory = "disabled";

}

--------------------------------------------------

B1, B2 and B3 represent the Chinese fields' binding name in FormB

A1, A2 and A3 represent the Chinese fields' binding name in FormA



(The script in radio button A is reversed in this way.)



Have I done something wrong in the above (click event) javascript?



Please help.



Thanks in advance.

Alex
0 Replies