Expand my Community achievements bar.

RadioButtons and CheckBoxes crossed results issue

Avatar

Level 3

Hello again,

I´m facing a new problem here:

  • I have this RadioButtons and CheckBoxes.
  • With the 2 sets of Radios (video and meal) you decide if there is going to be a video monitor and a meal tray.
  • With the 2 sets of CheckBoxes you decide where, the video or the meal, goes, if to the right or to the left
  • If you have a Video Monitor on the Right you can´t have  a Meal Tray on the right due to a lack of space; and you can´t have another Video Monitor on the left
  • If you have a Meal Tray on the Right you can´t have  a Video Monitor on the right due to a lack of space; and you can´t have another Meal Tray on the left

07-mar-13 15-18-14.png

  • By default all of the fileds have to be with any value (in case the form is going to be printed)

I thought this was working fine but after several checks and unchecks I arrive to unwanted states, like the ones that follows:

correct01.png

correct02.png

wrong01.png

wrong02.png

I have the following code on each of the Radio/ Checks (I´m deleting all form1.subform. etc etc, to justo leave the fields names):

1- Video Monitor Radio

form1.Subform2.RadioButtonListVideo::click - (JavaScript, client)

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

     TextVM1.font.lineThrough = "1";

     TextVM1.font.fill.color.value = "195,195,195";

     CheckBox1.access = "readOnly" ;

     TextVM2.font.lineThrough = "1";

     TextVM2.font.fill.color.value = "195,195,195";

     CheckBox10.access = "readOnly" ;

}  else {

     TextVM1.font.lineThrough = "0";

     TextVM1.font.fill.color.value = "51,51,51";

     CheckBox1.access = "open" ;

     TextVM2.font.lineThrough = "0";

     TextVM2.font.fill.color.value = "51,51,51";

     CheckBox10.access = "open" ;  

}

2- Meal Tray Radio

form1.Subform2.RadioButtonListMealT::click - (JavaScript, client)

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

     TextMT1.font.lineThrough = "1";

     TextMT1.font.fill.color.value = "195,195,195";

     CheckBox2.access = "readOnly" ;

     TextMT2.font.lineThrough = "1";

     TextMT2.font.fill.color.value = "195,195,195";

     Subform2.CheckBox11.access = "readOnly" ;   

} else {

     TextMT1.font.lineThrough = "0";

     TextMT1.font.fill.color.value = "51,51,51";

     CheckBox2.access = "open" ;

     TextMT2.font.lineThrough = "0";

     TextMT2.font.fill.color.value = "51,51,51";

     CheckBox11.access = "open" ;    

}

3- Right Checkboxes

-------> Video Monitor CheckBox

form1.Subform3.CheckBox1::click - (JavaScript, client)

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

           // meal tray of the right

           CheckBox2.access = "readOnly" ;

           TextMT1.font.lineThrough = "1";

           TextMT1.font.fill.color.value = "195,195,195";

           //other video monitor, on the left

           CheckBox10.access = "readOnly" ;

           TextVM2.font.lineThrough = "1";

           TextVM2.font.fill.color.value = "195,195,195";

    }

    else {

        //have to go back to "normal" states, by normal I mean not readonly, not striketrough and black font color

        CheckBox2.access = "open";

        TextMT1.font.lineThrough = "0";

        TextMT1.font.fill.color.value = "51,51,51";

        CheckBox10.access = "open";

        TextVM2.font.lineThrough = "0";

        TextVM2.font.fill.color.value = "51,51,51";

    }

-------> Meal Tray CheckBox

form1.Subform3.CheckBox2::click - (JavaScript, client)

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

           // video monitor, right

           CheckBox1.access = "readOnly" ;

           TextVM1.font.lineThrough = "1";

           TextVM1.font.fill.color.value = "195,195,195";

           //the other meal tray, on the left

           CheckBox11.access = "readOnly" ;

           TextMT2.font.lineThrough = "1";

           TextMT2.font.fill.color.value = "195,195,195";

    }

    else {

          //have to go back to "normal" states

        CheckBox1.access = "open";

        TextVM1.font.lineThrough = "0";

        TextVM1.font.fill.color.value = "51,51,51";

        CheckBox11.access = "open";

        TextMT2.font.lineThrough = "0";

        TextMT2.font.fill.color.value = "51,51,51";

    }

4- Left Checkboxes


-------> Video Monitor CheckBox    (is the same code as themeal tray from the right)

form1.Subform3.CheckBox11::click - (JavaScript, client)

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

           // video monitor, right

           CheckBox1.access = "readOnly" ;

           TextVM1.font.lineThrough = "1";

           TextVM1.font.fill.color.value = "195,195,195";

           //the other meal tray, on the left

           CheckBox11.access = "readOnly" ;

           TextMT2.font.lineThrough = "1";

           TextMT2.font.fill.color.value = "195,195,195";

    }

    else {

          //have to go back to "normal" states

        CheckBox1.access = "open";

        TextVM1.font.lineThrough = "0";

        TextVM1.font.fill.color.value = "51,51,51";

        CheckBox11.access = "open";

        TextMT2.font.lineThrough = "0";

        TextMT2.font.fill.color.value = "51,51,51";

    }

-------> Meal Tray CheckBox   (is the same code as the video monitor from the right)

form1.Subform3.CheckBox1::click - (JavaScript, client)

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

           // meal tray of the right

           CheckBox2.access = "readOnly" ;

           TextMT1.font.lineThrough = "1";

           TextMT1.font.fill.color.value = "195,195,195";

           //other video monitor, on the left

           CheckBox10.access = "readOnly" ;

           TextVM2.font.lineThrough = "1";

           TextVM2.font.fill.color.value = "195,195,195";

    }

    else {

        //have to go back to "normal" states, by normal I mean not readonly, not striketrough and black font color

        CheckBox2.access = "open";

        TextMT1.font.lineThrough = "0";

        TextMT1.font.fill.color.value = "51,51,51";

        CheckBox10.access = "open";

        TextVM2.font.lineThrough = "0";

        TextVM2.font.fill.color.value = "51,51,51";

    }

Any ideas on how to make this work right?

Also, how do I format the text to appear like code?

Thanks !!!!!

3 Replies

Avatar

Level 8

I took a different approach. To save on codeing I made the checkboxes at the bottom radio buttons then I gave the same name and global bindings. I inverted their values to left a=1, b=2 and on the right a=2, b=1. I didn't go to the trouble of coding all the cross out/access script you have but here is a rudimentary interpretation of what I think you want here.

PS to make your text look like code, click on Use advanced editor on the top right of the text box. There is a small chevron button that appears giving you more options.

Kyle