Skip to Content
avatar image
Former Member

CheckboxGroup: How can I read the "key" and "isChecked" values

Hello experts,

on my test JSP-site, I have following groupedCheckbox:

<hbj:checkboxGroup
								               id="cgIndexes"
								               columnCount="2"
								               > 
								
								              <hbj:checkbox
								                        id="CheckCPUStat"
								                        text="CPU status"
								                        key="chk_Stat"
								                        tooltip="Check CPU status"
								                        disabled="false"
								                        checked="true"
								              />
								
								              <hbj:checkbox
								                        id="CheckCPUUsuage"
								                        text="CPU usuage"
								                        key="chk_Use"
								                        tooltip="Actual CPU usuage"
								                        disabled="false"
								                        checked="false"
								              />
								
								              <hbj:checkbox
								                        id="CheckProc"
								                        text="Processes"
								                        key="chk_Process"
								                        tooltip="Show active processes"
								                        disabled="false"
								                        checked="false"
								              />
								
								              <hbj:checkbox
								                        id="CheckProc"
								                        text="Resources"
								                        key="chk_Res"
								                        tooltip="Available resources"
								                        disabled="false"
								                        checked="true"
								              />
								
								            </hbj:checkboxGroup>

Now I want to access the GroupedCheckbox using the "getComponentByName"-function

CheckboxGroup cgIndexes = (CheckboxGroup) this.getComponentByName("cgIndexes");

cgIndexes is not null when I use "cgIndexes" as parameter but will turn into null, when I use any other parameter (foobar). So I guess, that the function is returing the "right" data..

Now I was trying to access cgIndex, but without success:

Iterator cbgIndexIterator = cgIndexes.iterator();

Iterator has no elements.....

Checkbox cbIndexes =(Checkbox) cgIndexes.getComponentForKey("chk_Stat");
cbIndexes.isChecked();

Exception in PortalRequestManager.dispatchRequest without timeout

[EXCEPTION]

java.lang.NullPointerException

Any hints for me ?

Thank you in advance

Edited by: Khaled el Taki on Sep 25, 2008 3:14 PM

Edited by: Khaled el Taki on Sep 25, 2008 3:15 PM

Edited by: Khaled el Taki on Sep 25, 2008 4:10 PM

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Sep 26, 2008 at 11:53 AM

    I've tested now single checkboxes

    
    
        <hbj:checkbox
                  id="CheckCPU"
                  text="CPU status"
                  key="chk_k1"
                  tooltip="Check CPU status"
                  disabled="false"
                  checked="true"
    
         />
    
    

    I am able to check the checkbox, If it is checked or not.

    Checkbox cbTest = (Checkbox) this.getComponentByName("chk_k1");
    boolean isChecked = cbTest.isChecked();
    

    I'm getting a "true"...

    Any suggestions for CheckboxGroup ?

    Would appreciate your help

    Edited by: Khaloud on Sep 26, 2008 1:54 PM

    Add comment
    10|10000 characters needed characters exceeded