I am trying to create a user interface using selectOneRadio primers. Currently, I need to be able to display 5 images, which are actually radio buttons, and when I select an image, the image turns blue. The actual switch is locked.
I tried firstfaces selectOneRadio with a custom layout, but when I click on the image the radio button is not selected, and the button is also visible.
Here is my code. I use the base for css.
<ul class="small-block-grid-5">
<p:selectOneRadio value="scooter" id="vehicleType" layout="custom">
<f:selectItem itemValue="scooter" />
<f:selectItem itemValue="bike"/>
<f:selectItem itemValue="car"/>
<f:selectItem itemValue="plane" />
<f:selectItem itemValue="unknown" />
<f:ajax event="click" render="addCost"/>
</p:selectOneRadio>
<li>
<p:radioButton id="scooter" for="vehicleType" itemIndex="0"></p:radioButton>
<h:graphicImage for="scooter" value="/images/scooter.GIF" width="50" height="50"/>
</li>
<li>
<p:radioButton id="bike" for="vehicleType" itemIndex="1"></p:radioButton>
<h:graphicImage for="bike" value="/images/bike.GIF" width="50" height="50"/>
</li>
<li>
<p:radioButton id="car" for="vehicleType" itemIndex="2"></p:radioButton>
<h:graphicImage for="car" value="/images/car.GIF" width="50" height="50"/>
<h:panelGroup id="addCost">
<h:outputText styleClass="breadcrumbs" value="Add 10$" />
</h:panelGroup>
</li>
<li>
<p:radioButton id="plane" for="vehicleType" itemIndex="3"></p:radioButton>
<h:graphicImage for="plane" value="/images/plane.GIF" width="50" height="50"/>
</li>
<li>
<p:radioButton id="unknown" for="vehicleType" itemIndex="4"></p:radioButton>
<h:graphicImage for="unknown" value="/images/unkown.GIF" width="50" height="50"/>
</li>
</ul>
source
share