Skip to content

Instantly share code, notes, and snippets.

@victorabraham
Created August 14, 2015 05:55
Show Gist options
  • Select an option

  • Save victorabraham/88ebe8ca684b066a366a to your computer and use it in GitHub Desktop.

Select an option

Save victorabraham/88ebe8ca684b066a366a to your computer and use it in GitHub Desktop.
Controller for autocomplete page
public class AutoCompleteController {
//String property to pass JSON data to page
public String toEmailJSON{get;set;}
//String property to save the values selected by user
public String selectedEmails{get;set;}
//Constructor of the class where email addresses are obtained from custom setting and converted to JSON
public autocompleteController(){
Set<String> autocompleteEmailSet = AutocompleteEmails__c.getAll().keyset();
toEmailJSON = JSON.serialize(autocompleteEmailSet);
}
//Method to demonstrate that values are coming to controller on button click
public PageReference receiveValues() {
//Debugging the value passed from page
System.debug(selectedEmails);
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment