<?xml version="1.0"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Page comments</title>
		<link>http://www.ssbits.com/home/</link>
		<atom:link href="http://www.ssbits.com/home/" rel="self" type="application/rss+xml" />
		<description></description>

		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_1980</link>
			<description>Hi Aram,

I really would like to use this script on my site but I am unable to locate where I need to put my dbsettings, so where to connect to and I can also not find the actual query that I want to perform on my database. Can you help me getting this info?

Cheers,
Berry</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_1980</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_1836</link>
			<description>Hi Aram,

Thanks for the nice tutorial. . but the query isnt working for me havent played with MATCH and AGAINST much i usually go with like

getting  &quot;#1191 - Can't find FULLTEXT index matching the column list&quot; error when i try to run it through PHPMYADMIN

how can i fix this ?

</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_1836</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_1019</link>
			<description>Adam I was able to figure it out I just separated the functions like below.

All I need now is to be able to populate other fields based on the selected credit union from the auto complete. Any help would be appreciated.

function results() {
		if($credit_union = $this-&gt;getSearchQuery()) {
			$credit_union = Convert::raw2xml($credit_union); 
			
			//Search for our query - Pretty basic example here
			$Results = DataObject::get('CreditUnion', 
				&quot;MATCH (Name) AGAINST ('$credit_union') 
				OR Name LIKE '%$credit_union%'&quot;
			);

			//For AutoComplete
			if(Director::is_ajax()) {
				$Members = $Results-&gt;map('ID', 'Name');
				
				$Suggestions = &quot;['&quot; . implode(&quot;','&quot;,$Members) .&quot;']&quot;	;
				
				return $json = &quot;{
					query : '$credit_union',
					suggestions : $Suggestions
	 			}&quot;;
			}
		}
	}
	
	function doSignUp($data, $form) {
		
		// Store in DB
		$submission = new SignUpSubmission();
        $form-&gt;saveInto($submission);
        $submission-&gt;write();
		
		// E-mail it
		$From = $data['email'];
		$To = 'test@email.com';
		$Subject = 'Form Submission';
		$email = new Email($From, $To, $Subject);
		$email-&gt;setTemplate('Template');
		$email-&gt;populateTemplate($data);
		$email-&gt;send();
		
		// Auto Reply Email
		$autoFrom  = 'test@email.com';
		$autoTo = $data['email'];
		$autoSubject = 'Form Submission';
		$autoEmail = new Email($autoFrom, $autoTo, $autoSubject);
		$autoEmail-&gt;setTemplate('Template');
		$autoEmail-&gt;send();

		Director::redirect(Director::baseURL(). $this-&gt;URLSegment . &quot;/?signupsuccess=1&quot;);
	}</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_1019</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_1018</link>
			<description>
Hi Aram,

I have a dilemma. I was able to modify the code so that this works for me on a regular form with a thank you message.

I also want the form to save the data as a record but once I add the $form to results($data, $form) the autocomplete stops working. Any ideas?

&lt;?php
class MemberSearchPage extends Page {}

class MemberSearchPage_Controller extends Page_Controller {
	static $allowed_actions = array(
		'SignUpForm',
		'results'
	);
	
	public function init() {
		parent::init();

		//CSS
		Requirements::css(&quot;autocomplete/css/autocomplete.css&quot;);		
		
		//JS
		//Requirements::javascript(&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js&quot;);
		Requirements::javascript(&quot;autocomplete/javascript/jquery.autocomplete-min.js&quot;);
		Requirements::CustomScript(&quot;
		
			jQuery(document).ready(function() {
				var options, a;
				
				jQuery(function(){
				  options = { serviceUrl:'&quot; . $this-&gt;Link('results') . &quot;' };
				  a = jQuery('#Form_SignUpForm_credit_union').autocomplete(options);
				});						
				
			})
		
		&quot;);
	}
	
	public function SignUpSuccess() {
		return isset($_REQUEST['signupsuccess']) &amp;&amp; $_REQUEST['signupsuccess'] == &quot;1&quot;;
	}
	
	public function SignUpForm() {
		$fields = new FieldSet(
			new TextField('first_name','First Name*'),
			new TextField('last_name','Last Name*'),			
			new TextField('credit_union', 'Credit Union*', $this-&gt;getSearchQuery()),
			new EmailField('email','E-mail address*')
		);

		$actions = new FieldSet(
			new FormAction('results', 'Submit')
		);
		
		$validator = new RequiredFields('first_name', 'last_name', 'credit_union', 'email');
		
		$form = new Form($this, 'SignUpForm', $fields, $actions, $validator);
		
		return $form;
	}

	function results($data, $form) {
		if($credit_union = $this-&gt;getSearchQuery()) {
			$credit_union = Convert::raw2xml($credit_union); 
			
			//Search for our query - Pretty basic example here
			$Results = DataObject::get('CreditUnion', 
				&quot;MATCH (Name) AGAINST ('$credit_union') 
				OR Name LIKE '%$credit_union%'&quot;
			);

			//For AutoComplete
			if(Director::is_ajax()) {
				$Members = $Results-&gt;map('ID', 'Name');
				
				$Suggestions = &quot;['&quot; . implode(&quot;','&quot;,$Members) .&quot;']&quot;	;
				
				return $json = &quot;{
					query : '$credit_union',
					suggestions : $Suggestions
	 			}&quot;;
			}
		}
		
		// Store in DB
		$submission = new SignUpSubmission();
        $form-&gt;saveInto($submission);
        $submission-&gt;write();
		
		// E-mail it
		$From = $data['email'];
		$To = 'email@test.com';
		$Subject = 'Form Submission';
		$email = new Email($From, $To, $Subject);
		$email-&gt;setTemplate('Template');
		$email-&gt;populateTemplate($data);
		$email-&gt;send();
		
		// Auto Reply Email
		$autoFrom  = 'test@email.com';
		$autoTo = $data['email'];
		$autoSubject = 'Form Submission';
		$autoEmail = new Email($autoFrom, $autoTo, $autoSubject);
		$autoEmail-&gt;setTemplate('EmailSignUpTHINK12Reply');
		$autoEmail-&gt;send();

		Director::redirect(Director::baseURL(). $this-&gt;URLSegment . &quot;/?signupsuccess=1&quot;);
	}

	function getSearchQuery() {
		if($this-&gt;request)
			return $this-&gt;request-&gt;getVar(&quot;query&quot;);
	}
}</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_1018</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_854</link>
			<description>Hi Victor,

It's possible, but too much for me to explain right now. Effectively you need to trigger an ajax call to a function which get's the second dropdowns items based on the first, so the URL might be yoursite.com/getdropdown/city/{name} and the same for the stage. The autocomplete would work in much the same way but you would need to adapt the results() function to get the Location objects and search their Name fields.</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_854</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_853</link>
			<description>How would I go about doing this for a list of locations added through the CMS instead of Members.

For Example I want to add locations in the admin with a Name, City and State. I want to have a form with 3 fields: 1) Name, 2) City, and 3) State. When the user begins to fill out the Name field I want it to begin displaying the name of the locations added to the admin. When 1 is chosen I want the City and State fields to get automatically populated with the data in the admin that's associated to the name.

Is this even possible with SilverStripe?</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_853</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_828</link>
			<description>Great Silverstirpe Ajax tutoria, may just save my day! </description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_828</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_613</link>
			<description>another great ssbits post, you guys and unclecheese are doing a huge help to the SS community.

one thing I think might needed to be added to this you don't mention the AutocompleteMemberDecorator in the tutorial but it is in the downloaded source code, I was trying to follow the tutorial through and couldn't get the search to work so tried downloading the source and realise it was the indexes which were missing.

also  I couldn't get the autocomplete to work and was messing around with jquery for a while then realized that i needed to have the prototype turned off so in case it helps someone else

 Validator::set_javascript_validation_handler('none'); </description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_613</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_608</link>
			<description>Very nice, can't wait to try this! Excellent resources here</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_608</guid>
		</item>
		
		<item>
			<title></title>
			<link>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_607</link>
			<description>I take it the same principles outlined in this can be used to request whole pages via AJAX also?

I'm looking to implement an ajax search results page + ajax pagination (however I've found search to be really.. limited).

Should be fun!</description>
			<pubDate></pubDate>
			<dc:creator>RSSName</dc:creator>
			<guid>http://www.ssbits.com/tutorials/2011/create-an-ajax-auto-complete-member-search-with-silverstripe-and-jquery/#PageComment_607</guid>
		</item>
		

	</channel>
</rss>