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
Shivani JainShivani Jain 

how to get the ids of the checkboxes selected using jquery and pass the id to controller through actionFunction

I have a controller on account object . I am displaying records after some searching criteria with checkboxes infront each row . I want to send mass email to all the selected checkboxes and want to apply some validation in which i have to check wether the email field of each selected record is null or not . I am getting the ids of the selected records through jQuery and passing this ids to controller through ActionFunction.  But in controller the ids value is not fetching . Can any one tell some alternative solution or solution to this problem how to implement it .


Thanks in advance :)
Best Answer chosen by Shivani Jain
Vinit_KumarVinit_Kumar
Why are you using Jquery to store Ids any specific reason,the way I would be using to create a Wrapper class to store the Ids andsend emails based on them.

Go through the below links to learn more :-

https://developer.salesforce.com/page/Wrapper_Class

http://www.minddigital.com/what-is-wrapper-class-and-how-to-use-it-in-salesforce/

If this helps,please mark it as best answer to help others.

All Answers

Vinit_KumarVinit_Kumar
Why are you using Jquery to store Ids any specific reason,the way I would be using to create a Wrapper class to store the Ids andsend emails based on them.

Go through the below links to learn more :-

https://developer.salesforce.com/page/Wrapper_Class

http://www.minddigital.com/what-is-wrapper-class-and-how-to-use-it-in-salesforce/

If this helps,please mark it as best answer to help others.
This was selected as the best answer
Shivani JainShivani Jain
hi vinit ,

But i want to check validation on page before sending mail that wether the email field is empty or not . How can i do that ????????
Vinit_KumarVinit_Kumar
Why are you checking the same on page.

You can do the same in your controller method also and display an error message if it is blank,something like below :-


VF page 
<apex:inputText value="{!email}" id="theEmail" />
Controller 

public String email{get;set;}
	
	
// Send Email method
public void sendEmail()
{
	if(email!=null)
	
	{
		// send your email
	}
	
	else
	{
		//throw an error message
	}
}

If this helps,please mark it as best answer to help others.
Shivani JainShivani Jain
ohkk thanks .... :)
Vinit_KumarVinit_Kumar
Happy to help Shivani :)

Mark it as best answer to help others :)