AutoresizeBehaviour and ajax replace

55 views
Skip to first unread message

decebal

unread,
Mar 9, 2011, 8:40:04 AM3/9/11
to wiquery-plugins
Hi

I have a comment panel (EditCommentPanel) that contains a form with a
textarea and a submit form. When user do click on a comment button the
following code is executed:

Comment comment = commentService.findCommentById(commentId);
EditCommentPanel editCommentPanel = new
EditCommentPanel(REPLY_COMMENT_PANEL, comment);
addReplyCommentContainer.replace(editCommentPanel);
target.addComponent(addReplyCommentContainer);

How can I use the AutoresizeBehaviour in this situation?

Thanks,
Decebal

Ernesto Reinaldo Barreiro

unread,
Mar 9, 2011, 8:51:30 AM3/9/11
to wiquery...@googlegroups.com
AutoresizeBehaviour is meant to be used for text areas... See [1]. Do
you have a text area on your EditCommentPanel? Did you tried adding it
to that text area.

Regards,

Ernesto

1-http://james.padolsey.com/javascript/jquery-plugin-autoresize/

decebal

unread,
Mar 9, 2011, 9:39:25 AM3/9/11
to wiquery-plugins
Thanks for very fast response :)

Yes, in EditCommentPanel I have a form with a textarea and an
AjaxSubmitLink.

TextArea txtContent = new TextArea("content");
txtContent.setRequired(true);
txtContent.add(new AutoresizeBehaviour());
add(txtContent);

I think that I must add something javascript on AjaxRequestTarget
(like in your post
http://groups.google.com/group/wiquery/browse_thread/thread/635e1a15159edb41/ab64b16bd7d7285c?lnk=gst&q=ajax#ab64b16bd7d7285c)
.

On Mar 9, 3:51 pm, Ernesto Reinaldo Barreiro <reier...@gmail.com>
wrote:
> AutoresizeBehaviour is meant to be used for text areas... See [1]. Do
> you have a text area on your EditCommentPanel? Did you tried adding it
> to that text area.
>
> Regards,
>
> Ernesto
>
> 1-http://james.padolsey.com/javascript/jquery-plugin-autoresize/
>

Ernesto Reinaldo Barreiro

unread,
Mar 9, 2011, 9:46:02 AM3/9/11
to wiquery...@googlegroups.com
So you want your panel to appear once it is updated? This is no the
same as autoresize question? Did it work autoresize?

Best,

Ernesto

Decebal Suiu

unread,
Mar 9, 2011, 9:59:29 AM3/9/11
to wiquery...@googlegroups.com
I want to have in wicket a textarea with a behavior like
http://james.padolsey.com/javascript/jquery-plugin-autoresize/
Now autoresize doesn't work. I don't see any javascript contribution
(autoresize.jquery.min.js) on the head of the web page after textarea
appears (the textarea seems to be just a ... simple textarea).
I will try to create a quickstart.

Thanks,
Decebal

Decebal Suiu

unread,
Mar 9, 2011, 10:22:29 AM3/9/11
to wiquery...@googlegroups.com
Hello Ernesto,
What I needed to explain better is that I receive

ERROR: Wicket.Ajax.Call.processEvaluation: Exception evaluating
javascript: TypeError: $("#content1e9").autoResize is not a function.

That is probably because the ajax response did not contribute the
autoresize.jquery.min.js

I'm using
<dependency>
<groupId>com.wiquery-plugins</groupId>
<artifactId>other-plugins</artifactId>
<version>1.1</version>
</dependency>
and Wicket 1.4.13
Here is the ajax response:
NFO:
<?xml version="1.0"
encoding="UTF-8"?><ajax-response><header-contribution
encoding="wicket1" ><![CDATA[<head
xmlns:wicket="http://wicket.apache.org"><script type="text/javascript"
src="../resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js"></script>
<script type="text/javascript"
src="../resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js"></script>
<script type="text/javascript"
src="../resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js"></script>
<script type="text/javascript"
id="wicket-ajax-debug-enable"><!--/*--><![CDATA[/*><!--*/
wicketAjaxDebugEnable=true;
/*-->]^]^>*/</script>

<script type="text/javascript"
src="../resources/org.odlabs.wiquery.core.commons.CoreJavaScriptResourceReference/jquery/jquery-1.4.3.js"></script>
</head>]]></header-contribution><component
id="add_reply_comment_container1e6" ><![CDATA[<li
id="add_reply_comment_container1e6">
<div class="add-comment-reply"
id="add_reply_comment_panel1e8"><!-- MARKUP FOR
ro.myagora.web.comment.EditCommentPanel BEGIN -->
<form id="form1ea" method="post"
action="../?wicket:interface=:11:comments:comment-replies-container:add-reply-comment-container:add-reply-comment-panel:form::IFormSubmitListener::"><div
style="width:0px;height:0px;position:absolute;left:-100px;top:-100px;overflow:hidden"><input
type="hidden" name="form1ea_hf_0" id="form1ea_hf_0" /></div>
<div style="margin-right: 10px;">
<textarea rows="4" style="margin-right: 5px;"
placeholder="Introduceti comentariul" name="content"
id="content1e9"></textarea>
</div>
<div style="clear:left; float:right;">
<a href="#" class="button-link" id="save1eb" onclick="var
wcall=wicketSubmitFormById('form1ea',
'../?wicket:interface=:11:comments:comment-replies-container:add-reply-comment-container:add-reply-comment-panel:form:save::IActivePageBehaviorListener:0:1&amp;wicket:ignoreIfNotActive=true',
'save' ,function() { }.bind(this),function() { }.bind(this),
function() {return
Wicket.$$(this)&amp;&amp;Wicket.$$('form1ea')}.bind(this));;; return
false;">Trimite</a>
<a href="#" class="button-link" id="cancel1ec"
onclick="var wcall=wicketAjaxGet('../?wicket:interface=:11:comments:comment-replies-container:add-reply-comment-container:add-reply-comment-panel:form:cancel::IBehaviorListener:0:1',function()
{ }.bind(this),function() { }.bind(this), function() {return
Wicket.$('cancel1ec') != null;}.bind(this));return
!wcall;">Renunta</a>
</div>
<span class="feedbackPanelERROR" id="feedback1ed"><!-- MARKUP
FOR org.apache.wicket.markup.html.panel.FeedbackPanel BEGIN -->

<!-- MARKUP FOR org.apache.wicket.markup.html.panel.FeedbackPanel END --></span>
</form>
<!-- MARKUP FOR ro.myagora.web.comment.EditCommentPanel END --></div>
</li>]]></component><evaluate><![CDATA[setTimeout("var
wcall=wicketAjaxGet('../?wicket:interface=:11:comments:comment-replies-container:add-reply-comment-container:add-reply-comment-panel::IActivePageBehaviorListener:0:1&wicket:ignoreIfNotActive=true',function()
{ }.bind(this),function() { }.bind(this), function() {var c =
Wicket.$('add_reply_comment_panel1e8'); return typeof(c) !=
'undefined' && c != null}.bind(this));",
1200000);]]></evaluate><evaluate><![CDATA[document.getElementById('content1e9').focus();]]></evaluate><evaluate><![CDATA[$('#content1e9').autoResize({})
;]]></evaluate></ajax-response>
INFO: Response parsed. Now invoking steps...
INFO:
INFO: Initiating Ajax GET request on
../resources/org.odlabs.wiquery.core.commons.CoreJavaScriptResourceReference/jquery/jquery-1.4.3.js
INFO: Invoking pre-call handler(s)...
INFO: Received ajax response (180455 characters)
INFO: Invoking post-call handler(s)...
INFO: returned focused element: http://localhost:8080/post/www-p65#
INFO: returned focused element: http://localhost:8080/post/www-p65#
INFO: focus removed from reply1e4
ERROR: Wicket.Ajax.Call.processEvaluation: Exception evaluating
javascript: TypeError: $("#content1e9").autoResize is not a function

Thank you.

On Wed, Mar 9, 2011 at 4:46 PM, Ernesto Reinaldo Barreiro
<reie...@gmail.com> wrote:

decebal

unread,
Mar 10, 2011, 6:59:09 AM3/10/11
to wiquery-plugins
The problem was resolved. I forced in pom.xml a dependency to
wiquery-1.2.2 with:

<dependency>
<groupId>org.odlabs.wiquery</groupId>
<artifactId>wiquery</artifactId>
<version>1.2.2</version>
</dependency>

other-plugins 1.1 (the last version from wiquery-plugins maven
repository) has a dependecy to wiquery-1.1

On Mar 9, 4:46 pm, Ernesto Reinaldo Barreiro <reier...@gmail.com>
wrote:
> So you want your panel to appear once it is updated? This is no the
> same as autoresize question? Did it work autoresize?
>
> Best,
>
> Ernesto
>
> On Wed, Mar 9, 2011 at 3:39 PM, decebal <decebal.s...@gmail.com> wrote:
> > Thanks for very fast response :)
>
> > Yes, in EditCommentPanel I have a form with a textarea and an
> > AjaxSubmitLink.
>
> > TextArea txtContent = new TextArea("content");
> > txtContent.setRequired(true);
> > txtContent.add(new AutoresizeBehaviour());
> > add(txtContent);
>
> > I think that I must add something javascript on AjaxRequestTarget
> > (like in your post
> >http://groups.google.com/group/wiquery/browse_thread/thread/635e1a151...)

Ernesto Reinaldo Barreiro

unread,
Mar 10, 2011, 7:27:11 AM3/10/11
to wiquery...@googlegroups.com
Good to know! Sorry for not replaying before but work is killing me
over here:-( I had stated to create a test page to see if i could
reproduce it... I remember there was a bug on wiquery related to
header contributions not been added via AJAX replacements. Which looks
like your use case...

Ernesto

Reply all
Reply to author
Forward
0 new messages