Skip to Content
avatar image
Former Member

HTMLB Checkbox

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Feb 22, 2004 at 01:27 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 24, 2004 at 09:05 AM

    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

    Add comment
    10|10000 characters needed characters exceeded