You need to sign in to do that
Don't have an account?
Siddhant kande
Checkbox validation using javascript on Visualforce Page
Hello All,
I have following vf code which populates the checkbox on browser as given below.
VF Code:
<Apex:pageBlockSection title="Products" columns="1" id="pbsec55" >
<apex:selectCheckboxes id="products" value="{!product}">
<apex:selectOptions value="{!productOption}" id="items"></apex:selectOptions>
</apex:selectCheckboxes>
</Apex:pageblockSection>
Browser
QA:
I want that before this form is submitted at least on check box must be checked. Would like to do checkbox validation using javascript.
Also, what are different ways I can to do checkbox validation on visualforce page?
I have following vf code which populates the checkbox on browser as given below.
VF Code:
<Apex:pageBlockSection title="Products" columns="1" id="pbsec55" >
<apex:selectCheckboxes id="products" value="{!product}">
<apex:selectOptions value="{!productOption}" id="items"></apex:selectOptions>
</apex:selectCheckboxes>
</Apex:pageblockSection>
Browser
QA:
I want that before this form is submitted at least on check box must be checked. Would like to do checkbox validation using javascript.
Also, what are different ways I can to do checkbox validation on visualforce page?
Sumitkumar_Shingavi
It is pretty easy. Don't use JS for this. When you say "before this form is submitted" means you must be having a button so just add a validation in the beginning of your Submit method check on if(product != null) and you need to intialize product = null in constructor for this validation. Hope this helps!
Michael Alamag 2
I got same issue. Is anyone here already encountered this and solved it?