Gary VanMatre wrote:
From: Richard Wallace <[EMAIL PROTECTED]>
Hello,
I'm trying to use radio buttons to do a questionnaire with the questions
pulled from a backing bean. There are examples of using select menus in
the use-cases but I don't see anything about how to use radio buttons.
The radio list "selectOneRadio" is very similar to the "selectOneMenu"
in that both require child "selectItems" component or "selectItem"s
components.
So, there is not really any html equivalentcy but you can use a "select"
and supply a jsfid of "selectOneRadio". But, this won't give you the
html mockup.
<select jsfid="selectOneRadio">
<option value="1"> One
<option value="2">Two
</select>
Another option would be to use the "void" jsfid and span tags.
<span jsfid=void allowbody=false>
<input type=radio value=1>
</span>
<span jsfid="selectOneRadio"><span jsfid=selectItem itemValue=One itemLabel=1/><span
jsfid=selectItem itemValue=Two itemLabel=2/></span>
So, the first span bound to a "void" jsfid will be removed. The second will
represent the radio list.
But, the "selectOneRadio" can not have any whitespace characters. The html
parser actually
adds whitespace as a verbatim components. All of the html template is
represented by
components. This is different than how JSP handles the view. Clay's method is actually much
simpler than trying to interweave jsp output with component output. Anyway, the
selectOneRadio component will not allow a verbatim/outputText child component.
The html "select" has an implicit mapping to the "selectOneMenu" component.
The builder
knows to strip out html white space nodes under the "select" node.
I guess this is a bug. We should handle this for the span node like the select
node or
allow the html input node to allow children. The parser assumes that the
"input"
node is self terminating.
But am getting the error "A duplicate component id (response) was found
within the same naming container (renderId="123" jsfid="selectOneRadio"
The duplicate id is coming from the fact that you have given all the components
the same html name attribute. The name or id attribute is mapped to
the component's id. You are correct on the "selectOneRadio" mapping.
I think that I've given you a couple options but please file a bug ticket on
this one.
Gary
Interesting options. I decided that for this case it's not incredibly
important to have the html mockup so went and created my first ever
component in the clay-config.xml. Came out perfect the first time. I'm
amazed at how easy it was to do. Still, it would be nice to have a good
way to do this from the pure html file. I'm not sure exactly what that
should look like tho. All the spans just look messy and would is quite
a bit harder to understand. Why not add an attribute to the <input> tag
like "group"? Then, in my example, rather than name="response" on all
the related radio buttons you have group="response". The biggest
problem that I can see with that is that it would be impossible to do a
single pass through the document to determine what radio buttons make up
the same selectOneRadio component. Maybe this would call for a new JSF
component or something. I don't know, just throwing some ideas out there.
As long as we're on the subject,one thing that I really don't like about
the SelectOneRadio component in JSF is that the radio buttons need to be
right next to each other. So, there's no easy way, for instance, to
have a radio button in the far right of each row of a table to allow the
user to select the row they want to perform some action on.
Thanks,
Rich
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]