You need to sign in to do that
Don't have an account?
SeattleSFDC
InputTextArea Required based on previous response
I'm trying to make an InputTextArea required based on a previous response. To be specific, if the onSiteSupport radiobutton selection = 'Yes' then make onSiteSupportCoverage InputTextArea required, if the response is 'No' then onSiteSupportCoverage is not required. What's the easiest way to accomplish this? I tried an inline IF statement, but it's not working.
<div class="questionRadio"><span class="required">*</span> Onsite customer support?</div> <div class="questionRadioInput"> <apex:selectRadio value="{!onSiteSupport}" id="onsite" required="true"> <apex:selectOption itemValue="Yes" itemLabel="Yes"/> <apex:selectOption itemValue="No" itemLabel="No"/> </apex:selectRadio> <apex:message styleClass="customError" for="onsite"/> </div> <div class="question"> If yes, then where?</div> <div class="longInputWrapper"> <apex:inputTextArea value="{!onSiteSupportCoverage}" styleClass="longInput" id="onSiteSupportCoverage" required="{!If(onSiteSupport == 'Yes',true,false)}"/> <apex:message styleClass="customError" for="onSiteSupportCoverage"/> </div>
When you are selecting radiobutton that time value of SelectOption is not passing into controller.What you can do is either create a button to pass the value to controller or you can use onselect attribute.
I have created one example in my org its working fine.Have a look I have used apex:message to check the error message on apex:inputtextArea field..
Hope this helps !!!
If this answer helps,please mark it as best answer to help others :)
Thanks