Search code examples
jspjstlsap-commerce-cloud

how to create form that has multiple checkbox in hybris


I have to create a form that has two radio buttons, one input field, I am able to create an input field but I'm not able to create radio buttons. enter image description here

can anybody with experience with Hybris please help.


Solution

  • Keep the path attribute same for both radio button, so you will get the selected value in your submitted form.

    Like

    <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
    <%@ taglib prefix="formElement" tagdir="/WEB-INF/tags/responsive/formElement" %>
    <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
    
    <form:form id="yourFormId" commandName="yourForm" action="${request.contextPath}/submit/url" method="post">
    
        <form:radiobutton path="dataType" value="halfHrsData" label="Detailed Data" />
        <form:radiobutton path="dataType" value="monthlyData" label="Summary Data" />
        <formElement:formInputBox labelKey="email.label" path="email" />
    
        <button id="buttonId" type="submit" >
            <spring:theme code="submit.button"/>
        </button>
    
    </form:form>