I am currently utilizing js-lib to transform text into a rich-editor, complete with options such as "bold", "italic" and more.
The RichEditor also includes an UploadImage button, for which I am able to modify the call-back function:
function startUploadingImage(field_name, url, type, win) {
//
}
In addition, I have designed a modal window for selecting files. My question is, how can I trigger wicket from the "startUploadingImage" function?
I attempted something like this:
// Java-script:
function startUploadingImage(field_name, url, type, win) {
wicketAjaxGet('..?1-1.IBehaviorListener.0-&action=uploadImage');
}
// and Wicket (class extends WebPage):
clickBehavior = new AbstractDefaultAjaxBehavior() {
@Override
protected void respond(AjaxRequestTarget target) {
IRequestParameters requestParameters = getRequestCycle().getRequest().getRequestParameters();
String action = requestParameters.getParameterValue("action").toString();
if (action.equals("uploadImage"))
modal1.show(target);
}
};
add(clickBehavior);
Unfortunately, this method did not work as expected. I am still in the early stages of learning wicket, so I am facing some challenges.