cancel
Showing results for 
Search instead for 
Did you mean: 

HTMLB Checkbox

Former Member
0 Kudos

Hi,

i'm trying to get the checkbox value for each row in a tableView.

TableView table = (TableView) this.getComponentByName("PORevTable");

if (table != null)

{

for (int i = 1; i <= table.getRowCount(); i++)

{

Checkbox chk = (Checkbox) this.getPageContext().getTableComponentForId("PORevTable","chkRev",i);

PortalRuntime.getLogger(IPortalConstants.IVIEW_LOGGER).info(null,chk.isChecked());

}

}

But the problem is that i am using a "disable" and "checked" checkbox (because user cannot uncheck what they already agreed).

My CellRenderer looks like this:

else if (column == 4)

{

Checkbox chk = new Checkbox("chkRev");

if (tableView.getValueAt(row, column).toString().equals("1"))

{

chk.setEnabled(false);

chk.setChecked(true);

}

else

{

chk.setChecked(false);

}

chk.render(rendererContext);

}

When i run it, i ALWAYS get a false value for the "disabled" checkbox.

I saw a method isEnable() for the Checkbox object but it always returns true.

Thanks you for your help,

Marjolaine

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Marjolaine,

it is not possible to get the value of disabled controls (like Checkbox, DropdownListBox, etc.), because if they are disabled they cannot be changed and thus you know the actual state (cause you set it). As far as I know only disabled input fields can be read.

Regards,

Stefan

Oliver_S
Advisor
Advisor
0 Kudos

Hi Marjolaine,

I chekced the docu (how it should work):

checked

A boolean value that that indicates if a checkBox is selected. "True" shows a check mark in a checkBox and indicates that the checkBox is selected, "false" leaves the checkBox empty and indicates that the checkBox is not selected.

isChecked

public boolean isChecked()Check select state.

Returns:

true if Checkbox was/is checked

As far is I know it works, and the sample in PDk also works. I think it you just made a mistake in eventhandling, just follow the sample in PDK.

BR,

Oliver