OnChange event with checkboxes

I have a checkbox and 2 hidden password fields in a form:

[code]{type: ‘checkbox’, name: ‘setPassword’, label: ‘Set Privacy Password’},
{type: ‘block’, width:400, list: [
{type: ‘password’, name: ‘password’,label: ‘Password’, hidden: ‘true’},
{type: ‘password’, name: ‘confirm’, label: ‘Confirm’, hidden: ‘true’},

	]},[/code]

I want to show the password fields when you check the box.

form6.attachEvent("onChange", function(setPassword, value, isChecked) { form6.showItem("password"); form6.showItem("confirm"); });

The problem I’m having is that the password fields show whenever any fields on the form are changed, rather than just the checkbox. Any idea what I’m doing wrong?

Hello
Try the next approach:

[code]formData = [
{type: “settings”, position: “label-right”},
{type: ‘checkbox’, name: ‘setPassword’, label: ‘Set Privacy Password’},
{type: ‘block’, name: ‘hiddenBlock’, width:400, hidden: ‘true’, list: [
{type: ‘password’, name: ‘password’,label: ‘Password’},
{type: ‘password’, name: ‘confirm’, label: ‘Confirm’}

            ]}
		];
        form6 = new dhtmlXForm("myForm", formData);
        form6.attachEvent("onChange", function(name,value,is_checked){
			if(name == "setPassword" && is_checked == true){
                form6.showItem("hiddenBlock");
            }
            else form6.hideItem("hiddenBlock");
		});[/code]