Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

selectManyCheckbox set unique ID

843844Jul 19 2007 — edited Jul 20 2007
Hi everybody,

I have a problem for getting, a specific Checkbox in my page.
I explain me :

I create a list of 20-30 checkbox in my page by using <html:selectManyCheckbox/>

if I write a Id : <html:selectManyCheckbox id="foo"/>

In the generated code I get the attribute name called "foo" but no attribute Id

And I realy need a unique Id for all those checkbox. Is there a way to get it ?

Thx a lot

Comments

843844
And I realy need a unique Id for all those checkbox.
Why? Maybe there are other ways.
843844
Yes maybe...

So : when the user click on the checkbox : I run a Javascript who display a div containing a text message.
Also, a request is send to the server, for updating the DB. (use A4j:support)
When the request is done, I delete the message.

Actually this message is display on top of the screen.
But I want it on/near the checkbox I checked/unchecked.

That's it ;)
843844
Which JSF version are you using? I just see the ID's here:

JSF
<h:form id="form">
    <h:selectManyCheckbox id="checkboxes" value="#{myBean.selectedItems}">
        <f:selectItems value="#{myBean.selectItems}" />
    </h:selectManyCheckbox>
</h:form>
which renders
<form id="form" name="form" method="post" action="/TestWebApp/test.jsf" enctype="application/x-www-form-urlencoded">
    <table id="form:checkboxes">
        <tr>
            <td><input name="form:checkboxes" id="form:checkboxes:0" value="value1" type="checkbox" /><label for="form:checkboxes:0"> label1</label></td>
            <td><input name="form:checkboxes" id="form:checkboxes:1" value="value2" type="checkbox" /><label for="form:checkboxes:1"> label2</label></td>
            <td><input name="form:checkboxes" id="form:checkboxes:2" value="value3" type="checkbox" /><label for="form:checkboxes:2"> label3</label></td>
        </tr>
    </table>

    <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id1:j_id2" />
    <input type="hidden" name="form" value="form" />
</form>
843844
Thats crazy, I do exacty the same but I don't have any Id displayed in the rendered code.
<html:selectManyCheckbox layout="pageDirection" id="races" value="#{settings.selectedRaces}"
            						 onclick="fadeIn(this)" enabledClass="TextBlue" disabledClass="TextBlueDisabled">
              <core:selectItems value="#{settings.allRaces}" />
              <a4j:support event="onchange" action="#{settings.updateRaces}" reRender="races" oncomplete="fadeOut()"/>
            </html:selectManyCheckbox>
and no Id generated....Rrrrr.

Myfaces version : 1.1.5
843844
Nobody know what's wrong ?

thx
1 - 5
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 17 2007
Added on Jul 19 2007
5 comments
67 views