Another great addition to the EE arsenal. I’ve just spent some time with v1.1 trying to get the add_callback_submit parameter to work. I’m trying to use it to call a jquery function that fades out the comment form after the comment was successfully sent and place the success/comment moderation message in its place but I keep getting and error. I’ve created a jQuery function named “comAway” but no matter how I format this I still get an error. Could you post a simple example?
It’s simple.
Create anywhere on the main template a function:
< sript >
function my_callback() {
alert("New comment submitted!");
}
</ script >Then add this parameter to exp:ajax_babble:script tag:
add_callback_submit="my_callback"Another great addition to the EE arsenal. I’ve just spent some time with v1.1 trying to get the add_callback_submit parameter to work. I’m trying to use it to call a jquery function that fades out the comment form after the comment was successfully sent and place the success/comment moderation message in its place but I keep getting and error. I’ve created a jQuery function named “comAway” but no matter how I format this I still get an error. Could you post a simple example?It’s simple. Create anywhere on the main template a function:Then add this parameter to exp:ajax_babble:script tag:< sript > function my_callback() { alert("New comment submitted!"); } </ script >add_callback_submit="my_callback"
Ah. OK, it works if I put the function in the same template, but not if I put it in the main linked script, which is linked in the header, so I thought it should work. Is this a parsing order issue?
OK, it works if I put the function in the same template, but not if I put it in the main linked script, which is linked in the header, so I thought it should work.What do you mean by putting “it in the main linked script, which is linked in the header”?
I have a template named entry which has jquery and my main site script (js_spd) externally linked in the header which contains the function.
<s ript type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></s ript>
<s ript type="text/javascript" src="/index.php/common/js_spd/"></sc ipt>within spd_js script is
function comAway() { jQuery('#comment_form').hide() };Then the template with the weblog:entries and ajax:babble is embedded into that.
{embed="common/_center" pagetype="blog"}When I try
add_callback_submit=”comAway”
like that, I get errors (see screenshot), when I put the function directly into the _center template above {exp:ajax_babble:script…} tag, it works.
Hi,
I released version 1.2 of AJAX Babble plugin.
In this release several new variables were added to exp:ajax_babble:comments tag :
1) ajax_babble_url_title - outputs url_title number of the entry comments belong to.
2) ajax_babble_segment_1, ajax_babble_segment_2, ajax_babble_segment_3, ajax_babble_segment_4, ajax_babble_segment_5, ajax_babble_segment_6, ajax_babble_segment_7, ajax_babble_segment_8, ajax_babble_segment_9 - outputs segments of the URL which was used to output main template.
Hi,
I released version 1.3 of AJAX Babble plugin.
In this release I added support for pipe operator inside parameters “add_callback_submit” and “add_callback_paginate”. Support for pipe operator inside these parameters means that you can add several callback functions.
Not a big deal, of course, since it is always possible to wrap several javascript functions inside a new function, but sometimes this new feature can be handy by saving a few keystrokes.
Hi,
I released version 1.5 of AJAX Babble plugin.
In this release following new features were added:
1) variable {ajax_babble_search_trigger_segment} of the exp:ajax_babble:comments tag - outputs URL segment in which search triggering string is present.
2) variable {ajax_babble_weblog_name} of the exp:ajax_babble:comments tag - outputs short weblog name of the weblog entry being commented belongs to.
Hi,
I released version 1.6 of AJAX Babble plugin.
In this release following new feature was added:
Any name of javascript function which is used inside the value of “add_callback_submit” parameter or “add_callback_paginate” parameter now can be used as the name of a new parameter. The value of this parameter will be used as argument of the relevant javascript function. E.g. if you have parameter
add_callback_submit="my_callback"then you can add parameter
my_callback="5"the number “5” will be used as the argument for “my_calback” function. In case you need to call a function with several arguments, use javascript object. E.g. if you have parameter
add_callback_submit="new_callback"then you can add parameter
new_callback='{"value1": null,"value2": "some_string"}'Hi Laisvunas,
Thanks for another awesome plugin! Everything seems to be working fine - preview displays, comments entered earlier display, loading gif displays on submit - problem is that the new comment submitted doesn’t display and is not registered in the CP.
I am using the Structure module, perhaps that could be a problem, although the articles are in their own template group named the same. I also tried to implement your exact example, but the same thing happens. Here is my stripped down code to only show the essentials:
Main article template (articles/view):
{exp:weblog:entries weblog="articles" limit="1" status="not closed" disable="category_fields|member_data|pagination|trackbacks"}
<h3>Comments</h3>
<ol id="comments_container" class="commentlist">{embed="articles/_comments" entry_id="{entry_id}"}</ol>
<!--comment and preview containers go here...-->
<div id="comment-form-area">
<h3><a name="commentreply"></a>Leave a Comment</h3>
{exp:ajax_babble:script form_id="comment_form" entry_id="{entry_id}" comments_template_url="{homepage}articles/_comments/" preview_template_url="{homepage}articles/_preview/" comments_container_id="comments_container" preview_container_id="preview_container" submit_button_id="comments_submit_button" preview_button_id="comments_preview_button" comments_number_id="comments_number" css_id_to_scroll="comment_to_scroll" comments_progress_indicator_id="comments_progress_indicator" preview_progress_indicator_id="preview_progress_indicator" progress_indicator_class="progress_indicator" comments_error_message_id="comments_error_message" preview_error_message_id="preview_error_message" error_message_class="ajax_error"}
{exp:comment:form entry_id="{entry_id}}
<div id="respond">
{if logged_out}
<input name, email...
{/if}
<textarea tabindex="4" class="text_area" rows="10" cols="100%" id="comment" name="comment">{comment}</textarea></p>
{if captcha}{captcha}...{/if}
<input type="submit" value="Submit" class="bg postcomment" alt="Post Comment" name="submit" id="comments_submit_button" />
<input type="submit" id="comments_preview_button" name="preview" value="Preview" /></p>
</div>
{/exp:comment:form}
{/exp:weblog:entries}Comment template (articles/_comments):
{exp:ajax_babble:comments entry_id="{embed:entry_id}" limit="5" search_trigger="comment_" orderby="date" sort="asc" parse="inward"}
{exp:comment:entries entry_id="{ajax_babble_entry_id}" limit="5" orderby="date" sort="asc" paginate="top" dynamic="off"}
{paginate}
Page {current_page} of {total_pages} pages {pagination_links}
{/paginate}
<li {if "{ajax_babble_comment_id_to_scroll}"=="{comment_id}"}id="comment_to_scroll"{/if}><!--one comment-->
<div class="gravatar">
...
</div>
</li>
{if no_results}<li>Be the first to comment!</li>{/if}
{/exp:comment:entries}
{/exp:ajax_babble:comments}I must be missing something really simple? Thanks..
Hi,
I do not own Structure module license and therefore I cannot check if Structure module interferes with this plugin’s functionality.
Try to get AJAX Babble working on the site without Structure module then transfer templates on the site with Structure installed. This way you will find if Structure module has anything to do with AJAX Babble not working.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.