After 2 months working with Wicket I'm still quite impressed by this 
smart framework, but IMHO the most weak part of it is client-side 
scripting. So when you want to place a lot of javascript in html, using 
handlers like onclick, onkeyup etc, without using server at all (no 
ajax, no server callbacks) - it is too difficult (almost impossible). 
There are 2 big problems:

1. You can't use id attributes in scripts because wicket generates them. 
There is no way to get ID in javascript runtime.
2. Wicket escapes qoutes in javascript handlers in incorrect way. For 
example, it transforms  the following handler:

     onclick="test('test me')"

to the form:

    onclick="test(\"test me\")"

And browser (firefox, IE) doesn't understand it, giving "incorrect 
character" error.

So now I have to have a lot of java code like the following. And it 
would be MUCH better to define it in html.

                colorBox.add(new AttributeAppender("onclick", new 
AbstractReadOnlyModel() {

                    @Override
                    public Object getObject(Component component) {
                        return "document.getElementById('" + 
textField.getMarkupId() + "').value='" + color + "'; " +
                        "document.getElementById('" + 
ColorPicker.this.getMarkupId() + "').style.display='none'; " +
                        "document.getElementById('" + 
colorPreview.getMarkupId() + "').style.background='#" + color + "';";
                    }
                   
                }, ";"));


Is there any way to workaround this problems? Maybe something will be 
changed in wicket v2.0?

-- 
Andrew Klochkov


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to