Re: AjaxSubmitLink and AjaxRequestTarget.appendJavaScript

2013-08-30 Thread Martin Grigorov
Hi,


On Tue, Aug 27, 2013 at 5:21 PM, podmak pod...@azet.sk wrote:

 hi,
 I need add some js in my AjaxSubmitLink.onSubmit(AjaxRequestTarget target,
 Form? form) but it is not working. example on my onSubmit function:
 @Override
 protected void onSubmit (AjaxRequestTarget target, Form? form)
 {
 super.onSubmit(target, form);
 target.appendJavaScript(myJS);
 }

 Is appendJavaScript working only in AjaxLink or?


No.
It should work in this case too.
Check the http response body with Firebug or similar tool.



 thanks




 --
 View this message in context:
 http://apache-wicket.1842946.n4.nabble.com/AjaxSubmitLink-and-AjaxRequestTarget-appendJavaScript-tp4661101.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




AjaxSubmitLink and AjaxRequestTarget.appendJavaScript

2013-08-27 Thread podmak
hi, 
I need add some js in my AjaxSubmitLink.onSubmit(AjaxRequestTarget target,
Form? form) but it is not working. example on my onSubmit function:
@Override
protected void onSubmit (AjaxRequestTarget target, Form? form)
{
super.onSubmit(target, form);
target.appendJavaScript(myJS);
}

Is appendJavaScript working only in AjaxLink or?

thanks




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxSubmitLink-and-AjaxRequestTarget-appendJavaScript-tp4661101.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Unit Test AjaxRequestTarget.appendJavascript

2012-11-30 Thread Martin Grigorov
You can use PowerMock to register a mock via
WebApplication#newAjaxRequestTarget()


On Fri, Nov 30, 2012 at 4:16 PM, Tom Norton 
tomwnorton.mailing.li...@gmail.com wrote:

 Is it possible to test that appendJavascript is called on wicket 1.5?

 Thanks,
 Tom




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/


Re: Unit Test AjaxRequestTarget.appendJavascript

2012-11-30 Thread Tom Norton
Thanks a bunch :D


On Fri, Nov 30, 2012 at 10:19 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 You can use PowerMock to register a mock via
 WebApplication#newAjaxRequestTarget()


 On Fri, Nov 30, 2012 at 4:16 PM, Tom Norton 
 tomwnorton.mailing.li...@gmail.com wrote:

  Is it possible to test that appendJavascript is called on wicket 1.5?
 
  Thanks,
  Tom
 



 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com http://jweekend.com/



Re: Unit Test AjaxRequestTarget.appendJavascript

2012-11-30 Thread Tom Norton
I tried to implement this, but newAjaxRequestTarget is final :(


On Fri, Nov 30, 2012 at 10:24 AM, Tom Norton 
tomwnorton.mailing.li...@gmail.com wrote:

 Thanks a bunch :D


 On Fri, Nov 30, 2012 at 10:19 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 You can use PowerMock to register a mock via
 WebApplication#newAjaxRequestTarget()


 On Fri, Nov 30, 2012 at 4:16 PM, Tom Norton 
 tomwnorton.mailing.li...@gmail.com wrote:

  Is it possible to test that appendJavascript is called on wicket 1.5?
 
  Thanks,
  Tom
 



 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com http://jweekend.com/





Re: Unit Test AjaxRequestTarget.appendJavascript

2012-11-30 Thread Martin Grigorov
Sorry.
See org.apache.wicket.protocol.http.WebApplication#setAjaxRequestTargetProvider


On Fri, Nov 30, 2012 at 4:34 PM, Tom Norton 
tomwnorton.mailing.li...@gmail.com wrote:

 I tried to implement this, but newAjaxRequestTarget is final :(


 On Fri, Nov 30, 2012 at 10:24 AM, Tom Norton 
 tomwnorton.mailing.li...@gmail.com wrote:

  Thanks a bunch :D
 
 
  On Fri, Nov 30, 2012 at 10:19 AM, Martin Grigorov mgrigo...@apache.org
 wrote:
 
  You can use PowerMock to register a mock via
  WebApplication#newAjaxRequestTarget()
 
 
  On Fri, Nov 30, 2012 at 4:16 PM, Tom Norton 
  tomwnorton.mailing.li...@gmail.com wrote:
 
   Is it possible to test that appendJavascript is called on wicket 1.5?
  
   Thanks,
   Tom
  
 
 
 
  --
  Martin Grigorov
  jWeekend
  Training, Consulting, Development
  http://jWeekend.com http://jweekend.com/
 
 
 




-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com http://jweekend.com/


Re: Unit Test AjaxRequestTarget.appendJavascript

2012-11-30 Thread Tom Norton
I was finally able to get it to work with PowerMock.  I forgot to add both
the WebApplication and the AjaxRequestTarget to the PrepareForTest
annotation.

Thanks for your help,
Tom


On Fri, Nov 30, 2012 at 10:40 AM, Martin Grigorov mgrigo...@apache.orgwrote:

 Sorry.
 See
 org.apache.wicket.protocol.http.WebApplication#setAjaxRequestTargetProvider


 On Fri, Nov 30, 2012 at 4:34 PM, Tom Norton 
 tomwnorton.mailing.li...@gmail.com wrote:

  I tried to implement this, but newAjaxRequestTarget is final :(
 
 
  On Fri, Nov 30, 2012 at 10:24 AM, Tom Norton 
  tomwnorton.mailing.li...@gmail.com wrote:
 
   Thanks a bunch :D
  
  
   On Fri, Nov 30, 2012 at 10:19 AM, Martin Grigorov 
 mgrigo...@apache.org
  wrote:
  
   You can use PowerMock to register a mock via
   WebApplication#newAjaxRequestTarget()
  
  
   On Fri, Nov 30, 2012 at 4:16 PM, Tom Norton 
   tomwnorton.mailing.li...@gmail.com wrote:
  
Is it possible to test that appendJavascript is called on wicket
 1.5?
   
Thanks,
Tom
   
  
  
  
   --
   Martin Grigorov
   jWeekend
   Training, Consulting, Development
   http://jWeekend.com http://jweekend.com/
  
  
  
 



 --
 Martin Grigorov
 jWeekend
 Training, Consulting, Development
 http://jWeekend.com http://jweekend.com/



Wicket 1.5: AjaxRequestTarget.appendJavaScript() - multiple javascript evaluations

2011-09-14 Thread armandoxxx
Hi guys 

I have a question about how to avoid multiple evaluations of same
javascripts in AjaxRequestTarget.appendJavaScript().
I have a lots of components that append javascript to AjaxRequestTarget.
Some of these javascript strings are same and some are different. So what
I'm trying to figure out is how to avoid adding the same javascript to
AjaxRequestTarget.
Another thing I'm trying to figure out is how to add these strings in
appropriate order.

use case: 
- ajax button is clicked
- an event is created (AjaxRequestTarget is set as parameter) and send to
components
- Component A gets an event .. adds itself to AjaxRequestTarget and appends
some JS (resizeLayout());
- Component B gets an event .. adds itself to AjaxRequestTarget and appends
some JS (resizeLayout(), initScrollbar('ComponentB'));
- Component C gets an event .. adds itself to AjaxRequestTarget and appends
some JS (resizeLayout(), initScrollbar('ComponentC'));


Kind regards
Armando

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-AjaxRequestTarget-appendJavaScript-multiple-javascript-evaluations-tp3812785p3812785.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5: AjaxRequestTarget.appendJavaScript() - multiple javascript evaluations

2011-09-14 Thread Igor Vaynberg
instead of using ajaxrequettarget.appendjavascript() use
iheadercontributor#renderOnDomReadyJavascript(String), these
contributions are filtered and only unique ones are executed.

the ordering is a different problem. if you need such ordering instead
of using headercontributor let your components implement some other
interface and let the parents visit children that implement that
interface so it can collect and sort the javascript however it sees
fit before writing it out.

-igor


On Wed, Sep 14, 2011 at 6:10 AM, armandoxxx armando@dropchop.com wrote:
 Hi guys

 I have a question about how to avoid multiple evaluations of same
 javascripts in AjaxRequestTarget.appendJavaScript().
 I have a lots of components that append javascript to AjaxRequestTarget.
 Some of these javascript strings are same and some are different. So what
 I'm trying to figure out is how to avoid adding the same javascript to
 AjaxRequestTarget.
 Another thing I'm trying to figure out is how to add these strings in
 appropriate order.

 use case:
 - ajax button is clicked
 - an event is created (AjaxRequestTarget is set as parameter) and send to
 components
 - Component A gets an event .. adds itself to AjaxRequestTarget and appends
 some JS (resizeLayout());
 - Component B gets an event .. adds itself to AjaxRequestTarget and appends
 some JS (resizeLayout(), initScrollbar('ComponentB'));
 - Component C gets an event .. adds itself to AjaxRequestTarget and appends
 some JS (resizeLayout(), initScrollbar('ComponentC'));


 Kind regards
 Armando

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-AjaxRequestTarget-appendJavaScript-multiple-javascript-evaluations-tp3812785p3812785.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



flush ajaxRequestTarget.appendJavascript

2011-08-03 Thread Lurtz Nazgul
Hi;

When i append jquery progressbar script to AjaxRequestTarget like below

 for (int i = 0; i  101; i++) {

ajaxRequestTarget.appendJavascript($(document).ready(function() 
{\n +
$(\#progressbar\).progressbar({ value:  + i 
+  });\n +
}););

 //  other stuff
}


Wicket sends it to the server, but i need to flush that jquery script code in 
order to work progressbar. 

Any suggestions ?

Thanks.

Re: flush ajaxRequestTarget.appendJavascript

2011-08-03 Thread Lurtz Nazgul
I used AjaxSelfUpdatingTimerBehavior and it's done. 

Thanks.




From: Lurtz Nazgul lu...@ymail.com
To: users@wicket.apache.org
Sent: Wed, August 3, 2011 11:36:50 AM
Subject: flush ajaxRequestTarget.appendJavascript

Hi;

When i append jquery progressbar script to AjaxRequestTarget like below

for (int i = 0; i  101; i++) {

ajaxRequestTarget.appendJavascript($(document).ready(function() 
{\n +
$(\#progressbar\).progressbar({ value:  + i 
+  });\n +
}););

 //  other stuff
}


Wicket sends it to the server, but i need to flush that jquery script code in 
order to work progressbar. 

Any suggestions ?

Thanks.

Re: AjaxRequestTarget.appendJavascript broken arrays

2010-07-19 Thread DmitryM

Double checked.
Confirming no issue (probably my JS was broken at the time of initial
testing).

-Dmitry
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxRequestTarget-appendJavascript-broken-arrays-tp2290353p2294403.html
Sent from the Wicket - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



AjaxRequestTarget.appendJavascript broken arrays

2010-07-15 Thread DmitryM

Hello, guys

I've noticed one thing recently (could not find anything related in the
forum).
My Wicket is 1.4.9 and I needed a JSON data with arrays which is attached to
the Ajax response.

Currently I see that all arrays' closing brackets ']' are turned into ']^'
which technically breaks my JSON (and even simple javascript) being
returned.

Is it a bug or an expected behavior and I can do something about it?

Because when Ajax response is being evaluated javascript gets parsing error
and I'm not sure I have any control over it.

Thanks,
Dmitry
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxRequestTarget-appendJavascript-broken-arrays-tp2290353p2290353.html
Sent from the Wicket - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AjaxRequestTarget.appendJavascript broken arrays

2010-07-15 Thread John Armstrong
Are you sure its not actually ^M which is a windows CR/LF linefeed?

This may be causing the parser to choke if its passing them through as literals.

Long shot, sorry :)
J

On Thu, Jul 15, 2010 at 9:07 AM, DmitryM nsk...@aol.com wrote:

 Hello, guys

 I've noticed one thing recently (could not find anything related in the
 forum).
 My Wicket is 1.4.9 and I needed a JSON data with arrays which is attached to
 the Ajax response.

 Currently I see that all arrays' closing brackets ']' are turned into ']^'
 which technically breaks my JSON (and even simple javascript) being
 returned.

 Is it a bug or an expected behavior and I can do something about it?

 Because when Ajax response is being evaluated javascript gets parsing error
 and I'm not sure I have any control over it.

 Thanks,
 Dmitry
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/AjaxRequestTarget-appendJavascript-broken-arrays-tp2290353p2290353.html
 Sent from the Wicket - User mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AjaxRequestTarget.appendJavascript broken arrays

2010-07-15 Thread Igor Vaynberg
it is expected in order to escape any possible CDATA]] closing tags,
this is escaped back into ] by javascript on the client side.

-igor

On Thu, Jul 15, 2010 at 9:07 AM, DmitryM nsk...@aol.com wrote:

 Hello, guys

 I've noticed one thing recently (could not find anything related in the
 forum).
 My Wicket is 1.4.9 and I needed a JSON data with arrays which is attached to
 the Ajax response.

 Currently I see that all arrays' closing brackets ']' are turned into ']^'
 which technically breaks my JSON (and even simple javascript) being
 returned.

 Is it a bug or an expected behavior and I can do something about it?

 Because when Ajax response is being evaluated javascript gets parsing error
 and I'm not sure I have any control over it.

 Thanks,
 Dmitry
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/AjaxRequestTarget-appendJavascript-broken-arrays-tp2290353p2290353.html
 Sent from the Wicket - User mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AjaxRequestTarget.appendJavascript broken arrays

2010-07-15 Thread DmitryM

Okay, I will double check that (since it's still in the XML response coming
back to the page)
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxRequestTarget-appendJavascript-broken-arrays-tp2290353p2290924.html
Sent from the Wicket - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AjaxRequestTarget.appendJavascript broken arrays

2010-07-15 Thread Igor Vaynberg
yes, i think the debug window shows it unescaped.

-igor

On Thu, Jul 15, 2010 at 8:47 PM, DmitryM nsk...@aol.com wrote:

 Okay, I will double check that (since it's still in the XML response coming
 back to the page)
 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/AjaxRequestTarget-appendJavascript-broken-arrays-tp2290353p2290924.html
 Sent from the Wicket - User mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



AjaxRequestTarget.appendJavascript

2009-01-05 Thread Vitek Tajzich
Hi,

 

I have really newbe question. 

 

I did in my code (just for test):

 

target.appendJavascript(alert(message););

 

And I found in debug window:

 

evaluate![CDATA[alert(message);]]/evaluate

 

So I gues that alert Windows with my message should be displayed but it is
not.

 

How does the appendJavascript work?

 

Could you provide me with link or example?

 

Thanks

 

V.



1.4 trunk: AjaxRequestTarget.appendJavascript

2009-01-02 Thread Jan Kriesten

Hi,

current 1.4 trunk 'messes' with escaping '[' to '[^' on
AjaxRequestTarget.appendJavascript which leeds to non-functional Javascript (at
least on my FF 3) when using array indices on variables.

It worked fine before without problems here - where/in which cases is the
escacping for the CDATA necessary?

Best regards, --- Jan.



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org