You need to sign in to do that
Don't have an account?
satakshi
I want functionality where if checkbox is checked then only email will send to desired user otherwise it will throw an error "Please select atleast one contact". How it is possible?
<apex:pageBlockTable value="{!searchResults}" var="accWrap" id="table" >
<apex:column colspan="2">
<apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/> </apex:column>
<apex:column colspan="5" value="{!accWrap.acc.Name}" />
<apex:column colspan="5" value="{!accWrap.acc.Email}" />
<apex:column colspan="5" value="{!accWrap.acc.Phone}" />
</apex:pageBlockTable>
Throw an error if checkbox is not checked in vf page
I want functionality where if checkbox is checked then only email will send to desired user otherwise it will throw an error "Please select atleast one contact". How it is possible?
<apex:pageBlockTable value="{!searchResults}" var="accWrap" id="table" >
<apex:column colspan="2">
<apex:inputCheckbox value="{!accWrap.selected}" id="inputId"/> </apex:column>
<apex:column colspan="5" value="{!accWrap.acc.Name}" />
<apex:column colspan="5" value="{!accWrap.acc.Email}" />
<apex:column colspan="5" value="{!accWrap.acc.Phone}" />
</apex:pageBlockTable>
Hi satakshi,
Assuming you have some sort of event, like a button click, calling a PageReference method in the controller, you should be able to do this...
In you Visualforce page, inside the <apex:form> tag, add the following tag: That tag is a placeholder for the deplaying of messages, including error messages, on your Visualforce page. With that in place, inside your controller class in the method that is being called from the button click (or some other event), add the following code: That code checks the "selected" field and throws an error if it isn't checked (set to false). Because the method is a PageReference method, we return null so the user remains on the current page and it is simply refreshed to display the error.
I hope this helps.
Jason