I have a vf page with radiobuttons. This is rendered only when a condition satisfied. The radiobuttons need to be mandatory only when it is rendered. But the problem is even if the radio options are not visible, it gives the error - that radio option must be selected. Here is the code
<apex:outputPanel id="packageDelivery" rendered="{!IF(applicantInfo.Category__c=='Student (F)',True,False)}">
<div class="form-row">
<div class="form-label top"><strong>How should we send Package?<span class="required">*</span></strong></div>
<div class="form-field">
<apex:selectRadio id="Package_Delivery" value="{!selectedPackageDelivery}" required="true">
<apex:selectOptions value="{!listPackageDelivery}" />
</apex:selectRadio>
</div>
</div>
</apex:outputPanel>
I tried to change the required="true"
to required="{!IF(applicantInfo.Category__c=='Student (F)',True,False)}"
but it throws error which I cannot capture.
please help. how to make a field required only when it is rendered!