Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

auto check checkbox

Avatar

Former Community Member

Hi,

I am trying to have a check box auto checked if a value in another fields is over 5000.

Here is the script but it doesnt seem to be working.Any help would be appreciated.

 

var

x= form1.MainArea_en_2.Page2Subform.Granttotal.rawValue;

var y =form1.MainArea_en_3.calc_2.rawValue;

 

if

(x > 5000  ||  y ==1){

this.rawValue=1;

}else{

this.rawValue="";

}

Thank you.

3 Replies

Avatar

Level 8

This works for me, check the javascript console to see if the was an error.  What event and field is executing the script.

if ((NumericField1.rawValue > 5000) || (NumericField2.rawValue == 1)) {

CheckBox1.rawValue = "1";

} else {

CheckBox1.rawValue = "";

}

Avatar

Former Community Member

Thank you but it only seems to get checked when I click yes on another check box.I wanted this box to get checked whether I press yes or no in another check box as long as the value is over 5000.

Avatar

Level 8

Sorry I don't understand, I took the above code, put it on the click event of a checkbox and when the numeric field is > 5000 the second check box becomes checked.