I have posted this message 6 hours ago and it does not appear yet, so I
repost it. I apologize if it is posted twice. I am having great trouble
with the spam cops. I have to change my ip after each message I post to
the list :-(
it really says it succeeded? the call should never be made...
You're right. I have so many Ajax calls in my application that I did not
properly read the Ajax Debug dialog.
the entire call is not made because the handler has a broken js syntax
correct?
correct.
i think at the end you have to know where in the html this is going to
so that you can properly escape stuff. maybe some javadoc on the call
decorator - mind creating a patch?
As I did not fin d any information on Wicket site about how to submit a
patch, I enclosed it with this mail.
Regarding the problem of the missing semicolon at the end of the
"decorateScript" script, this could be avoided by having wicket insert a
semicolon. It does not even has to test for an existing one since two
semicolons won't hurt.
Pierre-Yves
-Igor
Pierre-Yves
Igor Vaynberg a écrit :
> not that much we can do since the event script is already in
quotes when
> in html eg onclick="foo();"
>
> if its a big problem write out the message in a standalone js
function
> and call that func from the call decorator.
>
> -Igor
>
>
> On 8/28/06, * Pierre-Yves Saumont* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> <mailto:[EMAIL PROTECTED] <mailto:[EMAIL
PROTECTED]>>>
> wrote:
>
> Hello,
>
> When defining a script to use with decorateOnFailureScript in
> AjaxCallDecorator, it is not possible do write:
>
> public CharSequence decorateOnFailureScript(CharSequence
script) {
> return "alert(\"message\")";
> }
>
> one can only use single quotes:
>
> public CharSequence decorateOnFailureScript(CharSequence
script) {
> return "alert('message')";
> }
>
> This creates two problems:
>
> 1) The first solution does not produce any error message. The
Ajax call
> just fails silently. There is no error indicated in the Ajax
Debug
> Dialog Box.
>
> 2) Some languages (at least French) make heavy use of single
quotes. If
> an error message is to be put between single quotes, all
single quotes
> inside the error message have to be escaped twice (once for
Java and
> once for Javascript. A message like :
>
> "S'il vous plait"
>
> has to be written:
>
> 'S\\'il vous plait'
>
> Although this is not a problem for a programmer ;-) , is can
be more
> problematic for the person who is in charge of translating
the English
> property file to French.
>
> Pierre-Yves
>
>
>
-------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services,
> security?
> Get stuff done quickly with pre-integrated technology to make
your
> job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
>
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
<http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642>
> <
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
<http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642>>
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
<mailto:Wicket-user@lists.sourceforge.net>
> <mailto:Wicket-user@lists.sourceforge.net
<mailto:Wicket-user@lists.sourceforge.net>>
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services,
security?
Get stuff done quickly with pre-integrated technology to make your
job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
<http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642>
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
<mailto:Wicket-user@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/wicket-user
/*
* $Id: org.eclipse.jdt.ui.prefs,v 1.6 2006/02/06 08:27:03 ivaynberg Exp $
* $Revision: 1.6 $ $Date: 2006/02/06 08:27:03 $
*
*
==============================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package wicket.ajax.calldecorator;
import wicket.ajax.IAjaxCallDecorator;
/**
* An adapter for implementations of [EMAIL PROTECTED] IAjaxCallDecorator}.
* <p>
* The returned scripts are rendered in the HTML as follow:
* <pre>
* <a href="javascript:[script]var wcall=wicketAjaxGet('[url]',
function() {[onSuccessScript]},
* function() {[onFailureScript});" ...>[text of the link]</a>
* </pre>
* As a result, using double quotes in the script will break the link syntax
and make it fail (or fallback in the
* case of an AjaxFallbackLink). So, if single quotes have to be inserted in
strings contained in the scripts, they
* must be properly escaped to pass through Java and Javascript, for example:
* <pre>
* return "alert('It\\'s ok!')";
* </pre>
* Also note that <tt>decorateScript(CharSequence script)</tt> should generally
append to the script rather
* than replace it:
* <pre>
* return "alert('Before ajax call');" + script;
* </pre>
* Both following examples will break the link:
* <pre>
* return "alert('Before ajax call');"; // missing to append the script
* return "alert('Before ajax call')" + script; // missing ";"
* </pre>
*
* @since 1.2
*
* @author Igor Vaynberg (ivaynberg)
*
*/
public abstract class AjaxCallDecorator implements IAjaxCallDecorator
{
/**
* @see wicket.ajax.IAjaxCallDecorator#decorateScript(CharSequence)
*/
public CharSequence decorateScript(CharSequence script)
{
return script;
}
/**
* @see
wicket.ajax.IAjaxCallDecorator#decorateOnSuccessScript(java.lang.String)
*/
public CharSequence decorateOnSuccessScript(CharSequence script)
{
return script;
}
/**
* @see
wicket.ajax.IAjaxCallDecorator#decorateOnFailureScript(java.lang.String)
*/
public CharSequence decorateOnFailureScript(CharSequence script)
{
return script;
}
}
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user