sebfz1 / wicket-jquery-ui

jQuery UI & Kendo UI integration in Wicket
http://www.7thweb.net/wicket-jquery-ui/
Other
92 stars 58 forks source link

AutoCompleteTextField shows javascript code if ACTF is added by AJAX #33

Closed Patrick1701 closed 11 years ago

Patrick1701 commented 11 years ago

Hi Sebastien, I have a form with a simple radiochoice toogle on top to replace input fields dynamically by ajax depending on what the user wants to enter (to avoid page roundtrips). So far so good...

On one particular choice I addOrReplace() an ACTF...

The ACTF shows parts of javascript code surrounding the available ACTF choices, then.

Adding the ACTF to the page without ajax, just usual add() it works correct. Must be some javascript escaping issue due to the dynamic replacement by ajax.

Screenshot attached.

kind regards Patrick Javascript_on_replace

sebfz1 commented 11 years ago

Hi Patrick,

This has been raised on issue #20. This is due to a wicket issue, for which I have opened a ticket... The ticket has been resolved on wicket-6.7.0 which will probably be released on next Friday.

Then, you will be able to use wicket-jquery-ui 6.7.0-SNAPSHOT with wicket-6.7.0 (already tested). I will looking forward for your feedback, because this is a major refactoring and I need some volunteers to test it. I am sorry to tell you that you have been shortlisted! ;)

Release announcement: https://groups.google.com/forum/?fromgroups=#!topic/wicket-jquery-ui/qdZZUePbA1s

Thanks & best regards! Sebastien.

Patrick1701 commented 11 years ago

I'm feeling honered... ;-)

I switched to the snapshot and fixed my compiler issues, so I will give you more feedback tomorrow or the next days.

Here a short first test result concerning the ACTF: What I'm wondering is... the javascript code parts in the ACTF choices disappeared without changing to wicket-6.7.0-SNAPSHOT. I just switched to your SNAPSHOT.

Patrick

sebfz1 commented 11 years ago

Hi Patrick,

First of all, thanks to having switched to 6.7.0-SNAPSHOT! Did the changelog helped you? Did I miss something in the changelog that could help others for the "migration"?

About the ACTF, the issue only appears when you re-attach the templated-ACTF in ajax (as you figured). But I guess it's impossible that wicket-jquery-ui-6.7.0 solves the issue by itself, except if you switched to wicket-6.7.0-SNAPSHOT, but you told me that's not the case. Furthermore, wicket-jquery-ui-6.7.0 is currently referencing wicket-6.0.0 so it's also not a maven dependency scope problem from my side... There is something I do not understand here...

Strange.

Thanks again & best regards! Sebastien.

Patrick1701 commented 11 years ago

Hi Sebastien, the changelog is good. Just misses the info about signature changes about overriding methods. Now "public" instead of "protected" for several components.

Concerning the ACTF: Perhaps the unexpected ACTF bevavior occurs when something went wrong in/with an own ITextRenderer and the JQeuryTemplate feature. I messed around with the ITextRenderer and the JQueryTemplates the last days and possibly implemented a bug... I dont know... maybe later on I fixed it without recognizing it.

Just brainstorming: If an exception occures on creating the json response for the ACTF (due to the ITextRenderer, e.g. NullPointer), and the json response can be rendered anyway... but is not perfectly valid, wicket recognizes this and changes the response type while error handling, or something?! Or... in development mode, wicket trys to modify response to let in show "plain" in the ajax debug window?

regards Patrick

sebfz1 commented 11 years ago

Hi Patrick,

Yes, the problem only occurs for templated ACTF, when re-attached in ajax...

About your question, I really don't know if wicket will recognize that a json object is broken... But I would be really surprised that it will change the response content-type in case of error, because it's explicitly set before sending the response back, (see AutoCompleteSourceBehavior). But I may be wrong...

Best regards, Sebastien.