asked
2016-10-24 10:04:43 +0800
psingh 963 ● 8 I am using dropupload and browse functionality to upload the file. I am checking for maximum file size in both the functionalities. In case if the file size exceeded I want to call my java method to show the error message
In ZUL File
<dropupload maxsize="51200" id="fileUpload"></dropupload>
<script defer="true">
<![CDATA[
var status = false;
var oldAlert = jq.alert;
jq.alert = function (msg, opts) {
alert(msg);
if (!msg.indexOf('the request was rejected because its size')){
status = true;
}
else{
//oldAlert(msg, opts);
status = true;
}
if (status) {
alert(status);
zAu.send(new zk.Event(zk.Widget.$('#fileUpload'), 'onDropFile', status, {toServer:true}));
}
}
]]>
</script>
In View Model,
@Listen("onDropFile = #fileUpload")
public void onDropFile( Event evt) {
if (evt.getData() != null) {
showError("Upload File size is exceeded");
}
}
Can anyone how this functionality will work out or is there any other way to call java method from ZUl file using JAVASVRIPT?