Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!

Problem with simple form dependency manipulation via JavaScript

Avatar

Former Community Member
Hello together,



I downloaded the demo version of LifeCycle Form Designer yesterday and I am pretty excited about this tool. Hopefully, once I have these little snags worked out, we can start using this tool across our company.



In any case, I have a problem with a simple form dependency manipulation via JavaScript. Here it is:



/*

Goal:



Would like the 3 check boxes (check_game1, check_game2, and check_game3)

to be disabled on form load. Once the "activate" (CheckBox1) check

box is checked, the 3 check boxes should be shown/enabled.



Problems:



If I set

check_game1.presence = "invisible";

check_game2.presence = "invisible";

check_game3.presence = "invisible";

on "form:ready", the check boxes aren't shown at all. The

goal of this was to have the game check boxes "disabled"

onLoad. Same as when the "activate" check box isn't checked.



The fillColor doesn't work as I would imagine either. It doesnt fill

the background, but rather the border.



*/



if (CheckBox1.rawValue == 1) {

// If user checks checkbox

check_game1.presence = "visible";

check_game1.fillColor = "255,255,255";

check_game2.presence = "visible";

check_game1.fillColor = "255,255,255";

check_game3.presence = "visible";

check_game1.fillColor = "255,255,255";

} else {

// If user unchecks checkbox

check_game1.presence = "invisible";

check_game1.fillColor = "90,90,90";

check_game2.presence = "invisible";

check_game1.fillColor = "90,90,90";

check_game3.presence = "invisible";

check_game1.fillColor = "90,90,90";

}



Any help with this would be greatly appreciated.



Kevin
3 Replies

Avatar

Former Community Member
I think I have this almost worked out...



if (CheckBox1.rawValue == 1) {

// If user checks checkbox

check_game1.access = "open";

check_game1.rawValue = 1;

check_game2.access = "open";

check_game2.rawValue = 1;

check_game3.access = "open";

check_game3.rawValue = 1;

} else {

// If user unchecks checkbox

check_game1.access = "readOnly";

check_game1.rawValue = 0;

check_game2.access = "readOnly";

check_game2.rawValue = 0;

check_game3.access = "readOnly";

check_game3.rawValue = 0;

}



I just have to figure out how to change... the BG.

Avatar

Former Community Member
You could also set the access to "protected" (in place of "readOnly").



To get the BG color changes, I think you'll need to save your form as dynamic, rather than static. Then, you can use the fillColor (I think it only fills the checkbox area itself though, not the bg behind the caption text) or you can try check_game1.border.fill.color.value if you want the bg of the caption area to change as well.

Avatar

Former Community Member
Thanks a lot for your reply.



It helped. I found a function that I am using, it will do for now. Ideally I want to put the read only functionality into that function, but that will have to wait until I get better at this JavaScript thing.



Thanks again,



Kevin