Checkbox holds previous status

Hello world

I have a check box and two panels. The check box is to specify if the user is a manager or not, if yes then the check box must be checked and choose groups/departments that, that manager is responsible for from the panels.

Problem is: The check box holds the previous status ex: Choose a user, specify that he is a manager and choose the groups from the panels then leave the page…choose another user (who is not the manager), but the check box will come back still checked as it was checked on the previous session.

Same thing as when first I choose the user who is not a manager (the check box will not be clicked and there will be no groups selected from the panels), if I leave the page, and come back with a user that is a manager, the check box will still be in-checked, until I check it, then it will show that there are groups already selected. (suppose the check box is checked and the groups are selected already).

How do I fix this, it’s weird…please help.

Thanks

Sinoyolo

Is it the check box bound to a table field? If not, what’s the logic that should set the value automatically?

No the check box is not bound to the table field…I tried, but couldn’t get it to work still.

The following is my Modified method on the check box. On properties: AutoDeclaration is Yes.

“chkmanager” is my check box:

public boolean modified()
{
boolean ret;
str manager;

ret = super();

element.lock();

if (this.value())

{
Panels.visible(true);
chkmanager.checked(true);
listPanel.parmRelationRangeValue(EmplTable.EmplId);
listPanel.parmRelationRangeRecId(EmplTable.RecId);
listPanel.fill();

}
else
{

Panels.visible(false);
chkmanager.checked(false);

}

element.unLock();

return ret;
}

Thanks

If the control is not bound to a table field, its value is not set automatically. It’s the expected behavior that the value doesn’t change when you choose another user.

Also, modified() method on the check box is executed when the check box itself changes, so it won’t help you in this case. (By the way, you shouldn’t change the value of chkmanager in it’s own modified() method at all.)

You need to explicitly set the value of chkmanager when user changes - depending on your implementation, it may be in datasource’s active() method or in modified() method of the control holding user ID.