Hi everyone,

I have a tapestr5-jquery component that to which I need to pass a function
in the configuration.

The component is
http://tapestry5-jquery.com/components/docsajaxupload;jsessionid=2CD857F51B90113A175C5B10EE09B138.57B580630AEA

My code looks like this

java

public JSONObject getUploadParams() {
        JSONObject params = new JSONObject();
        params.put("onSubmit", new
JSONLiteral(String.format("showUploadProgress()")));
        return params;
    }

tml file

<j:ajaxUpload t:id="imageUpload" t:multiple="false"
t:params="uploadParams">                                        <noscript>
             <p>JavaScript must be activated!</p>
         </noscript>
 </j:ajaxUpload>

javascript file

function showUploadProgress() {
    var showUploadProgress = function(id, fileName) {
        alert(123)
        $('.photo').removeClass('photo').addClass('photo-progress-reveal');
    }
    return showUploadProgress;
}

Technically speaking the code above works, however it breaks my ajax by
throwing the following errors (on remove server ajax wont even refresh only
error is thrown)

Communication with the server failed: null
Ajax failure: Status 200 for #{request.url}: null
Communication with the server failed: null
Ajax failure: Status 200 for #{request.url}: null
Communication with the server failed: null

I was advised on a certain occasion to user javascript closers (
https://github.com/got5/tapestry5-jquery/issues/244) but as seen above this
doesn't really help.

Does anyone have any better idea how to pass a function from configuration
to tapestry component?

Cheers

-- 
Sincerely
*Boris Horvat*

Reply via email to