autocomplete - Ajax is not defined error with symfony 1.4 and sfProtoculousPlugin -
i've been trying figure out few days now. more experienced take , tell me i'm doing wrong.
this built in symfony 1.4, of sfprotoculousplugin input_auto_complete_tag.
my template:
<?php echo input_auto_complete_tag( 'tag', /*id_of_field*/ '', /*default_value_of_field*/ 'tag/autocomplete', /*url_to_ajax_script*/ array('autocomplete' => 'off'), /*array_with_extra_tag_attributes*/ array('use_style' => 'true') /*array_with_options*/ ) ?> <input type="submit" name="submit" value="tag me!" /> ... </form> added top of routing.yml:
tag_autocomplete: url: /tag_autocomplete param: { module: tag, action: autocomplete } created templates/autocompletesuccess.php:
<ul> <?php foreach ($tags $tag): ?> <li><?php echo $tag ?></li> <?php endforeach; ?> </ul> added action modules/tag/actions/action.class.php file:
public function executeautocomplete(sfwebrequest $request) { $this->tags = questiontag::gettagsforuserlike( $this->getuser()->getguarduser()->getid(), $this->getrequestparameter('tag'), 10 ); } added method questiontag.class.php file:
public static function gettagsforuserlike($user_id, $tag, $max = 10) { $tags = doctrine_query::create() ->select('qt.tag') ->from('questiontag qt') ->where('qt.user_id = ?', $user_id) ->andwhere("qt.tag '%".$tag."%'") ->orderby('qt.tag') ->limit($max) ->fetcharray(); return $tags; } here generated js code:
//<![cdata[ new ajax.autocompleter('tag', 'tag_auto_complete', '/frontend_dev.php/tag_autocomplete', {}); //]]> in firebug console, following error:
ajax not defined [break on error] ...ax.autocompleter('tag', 'tag_auto_complete', '/frontend_dev.php/tag_autocomplete... i tried following command, supposedly copies 'assets' (js scripts) /web folder. seems have worked some, not me.
./symfony plugin:publish-assets sfprotoculousplugin i feel i'm there. appreciated. many in advance.
update 1
in /web/sfprotoculousplugin folder have:
css / input_auto_complete_tag.css js/ builder.js controls.js dragdrop.js effects.js index.html prototype.js scriptaculous.js slider.js sound.js unittest.js also, don't see <script> tag prototype.js inside.
solved
added app settings.yml:
all: .settings: prototype_web_dir: /sfprotoculousplugin and app view.yml:
javascripts: [%sf_prototype_web_dir%/js/prototype, %sf_prototype_web_dir%/js/scriptaculous] then ran ./symfony cc , refreshed page. works intended. j0k help.
first step, clean every thing, re-run publish
./symfony cc ./symfony plugin:publish-assets then, check web folder, there folder sfprotoculousplugin inside, css , js folder ?
when check network tab in firebug, there js flagged 404 ?
does prototype.js loaded ?
Comments
Post a Comment