cancel
Showing results for 
Search instead for 
Did you mean: 

HTMLB how to get checkbox value?

Former Member
0 Kudos

Hi all,

anyone knows how is possible to get the value of a checkbox in a DynPage?

Example:

  <hbj:checkbox

       id="CheckCPUStat"

       text="CPU status"

       key="chk_Stat"

  />

In this case i want to read the string "CPU status".

If I use the getText method, the returned value is always null, with the getTooltip method too.

please, help!

thanks a lot.

Gennaro

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi Gennaro,

Checkbox.getId() works fine.

So, i will suggest you to create the Check box with the same text and id and retrieve the text with Checkbox.getId() method. Nothing goes wrong with this.

But, this fails if you need two or more checkboxes with the same texts.

Checkbox cb = (Checkbox)this.getComponentByName("SAPR/3 ");

String text=cb.getId();

In JSP,

you could have as

<hbj:checkbox id="SAPR/3" text="SAPR/3" disabled="false"/>

hiope it helps..,

regards,

Vinoth

Former Member
0 Kudos

hi Vinoth,

it's a good solution, but i need to specify the checkbox codified value (in the id) and the checkbox value, because i get all values dinamically.

I've solved with a hidden field that supply the checkbox value and give it to me with a request.getParameter().

In this way:

<hbj:checkbox id="CheckCPUStat" text="CPU status" key="chk_Stat" />

<input type="hidden" name="CheckCPUStat_value" value="CPU status">

however thanks a lot for your help!

Gennaro

Answers (0)