I'm trying to make the following form in JSF 2.0 but a have some troubles:
How can I make
<h:selectOneRadio>
s with textboxes and textareas inside?How can I disbale the textareas or textboxes when the radio buton isn't selected?
Update: in fact, I have nothing yet about that form. I have only the basic datatable, I'm trying that:
<h:column>
<h:selectOneRadio id="radio" layout="pageDirection" onclick="uncheckOthers(this)" >
<f:selectItem id="radio_1" itemLabel="Accesion Number: ">
<h:inputTextarea id="radio" />
<!-- Or another one objet distinct to <f:selectItem> -->
</f:selectItem>
</h:selectOneRadio>
</h:column>
I found the uncheckOthers()
function in this web and the another function of which I think it does the same:
function seleccionarSequencesType(x){
document.getElementById("gi").disabled=true;
for (var i = 0; i < document.solicitud.sequencesType.length; i++) {
if (document.solicitud.sequencesType[i].checked) {
inhabilitar(document.getElementById(document.solicitud.sequencesType[i].value), false);
//document.getElementById(x.value).disabled=false;
} else {
inhabilitar(document.getElementById(document.solicitud.sequencesType[i].value), true);
//document.getElementById(document.solicitud.sequencesType[i].value).disabled=true;
}
}
}
function uncheckOthers(radio) {
var name = radio.name.substring(radio.name.lastIndexOf(':'));
var elements = radio.form.elements;
for (var i = 0; i < elements.length; i++) {
if (elements[i].name.substring(elements[i].name.lastIndexOf(':')) == name) {
elements[i].checked = false;
}
}
radio.checked = true;
}
I have a basic bean with String
properties to save the information of the textareas, but it isn't fully developed yet, because at first I want to achieve the above requirement.