function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kakasaheb EKKakasaheb EK 

How to Validate checkbox values on client side on SF1 app..??

Hi All,
I have created one vf & controller.
On vf page i am showing checkbox values & backendly I am using multi piclist field.

So when I clicking checkbox & storving it get strorved.

Now I want to do validation of checkbox as client side So I need to featch values in javascript & need to do validation.

But I am not able to do validation of validate checkbox .

Plz review the code its little tricky.
My VF page :- 

<apex:selectCheckboxes id="activityTracking" value="{!activityTracking}"    layout="pageDirection" >
   <apex:selectOptions value="{!activityTrackinglsOptions}"/>
 </apex:selectCheckboxes>

<script>
       function validate()
       {
          var test= JSON.serialize('{!activityTracking}');

      }
</script>
Controller:-
 public list<String> activityTracking { get;set;}
 activityTracking = new list<string>();

So plz tell me how I capture value in javascript..??

Thanks in Advance.
Kakasaheb
mritzimritzi
Apex:
<apex:selectCheckboxes id="activityTracking" value="{!activityTracking}" onchange="validate(this.id);"   layout="pageDirection" >
   <apex:selectOptions value="{!activityTrackinglsOptions}"/>
 </apex:selectCheckboxes>
Script
 
function validate(id)
       {
          var selectedVal= document.getElementById(id).value;
          // you can add your logic here

      }



Select it as Best Answer, if it solves your problem.
Kakasaheb EKKakasaheb EK
It's not direct html so we can not use this one... And this multi piklist value. Sent from Outlook Mobile