For this one you're going to be digging into
http://book.cakephp.org/view/1592/Js
You'll be able to use the JS Helpler to buffer() and write() to get
your javascript collected and sent out to your page. And/or you could
use Html Helper script() to load javascript files.
Probably you've written your form and fields using the Form Helper, so
forget about struggling to set the field id to 'input_box'. Why not
just cooperate with the helper which automatically sets the id to a
camel case modelNameFieldName?
Here's a sample of typical form helper output:
<input id="GalleryLabel" name="data[Gallery][label]" maxlength="150">
so you could write:
$("#GalleryLabel").autocomplete("autocomplete_ajax.cfm");
Regards
Don
On May 20, 7:59 am, MeatSandwich <[email protected]>
wrote:
> I'm new to javascript and I'm trying to
> usehttp://www.pengoworks.com/workshop/jquery/autocomplete.htmbut I don't
> understand the documentation.
>
> I want to usehttp://code.google.com/p/searchable-behaviour-for-cakephp/
> and the box I want the autocomplete to work its magic on is the
> searchable search box.
>
> I have no problem getting the searchable to work but in the docs for
> the autocomplete it just says copy the files to the relevant places
> and then use: $("selector").autocomplete(url [, options]); to make it
> work.
>
> eg:
> $("#input_box").autocomplete("autocomplete_ajax.cfm");
> In the above example, Autocomplete expects an input element with the
> id "input_box" to exist. When a user starts typing in the input box,
> the autocompleter will request autocomplete_ajax.cfm with a GET
> parameter named q that contains the current value of the input box
>
> But I don't understand where I'm meant to put that bit of code. Do I
> just include the js files somehow and simply name my searchable field
> "input_box"? Or I'm I meant to call the js somehow in in the
> controller or view or something?
>
> confused
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php