Binding my button to Upload image MVC

asked 2015-06-04 09:59:05 +0800

fredp gravatar image fredp flag of France
1 1

Hi, I found here : "zkframeworkhint.blogspot.fr/2013/09/zk-mvc-upload-example.html" that we can upload file by using "upload=true" attribute in button component.

But I am having some issues with binding my button, the onUpload method is not called. Here is my zul file :

<div id='window' apply='org.myProject.myController'
    hflex="1" vflex="1">

    <grid id="albumGrid" hflex="1" vflex="1" self="@define(content)"
        sclass="fgrid" style="cursor:pointer">
            <auxheader id="albumGridHeader" />
            <column hflex="1" />
            <column hflex="1" />
            <column hflex="1" />
            <column hflex="1" />
            <column hflex="1" />
            <column hflex="1" />

    <window id="uploadDialog" border="normal" hflex="1" vflex="1"
        position="center" visible="false" closable="true">
        <button id="up" label="Ajouter photo" upload="true"/>

In my Controller I can bind uploadDialog window using @Wire private Window uploadDialog; but I can't have "up" button binded, it is null every time. I tried @Wire("window > uploadDialog #up") private Button up; and other things like that but I can't find what I need to write to make it work

Could you help me to bind this button or the attribute to call my controller method on upload in zul file ?

Thank you

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2015-06-04 10:38:37 +0800

Darksu gravatar image Darksu
1991 1 4

Hello fredp,

You can refer to the following fiddle in order to accomplish your task:


Best Regards,


link publish delete flag offensive edit

answered 2015-06-05 02:37:17 +0800

jumperchen gravatar image jumperchen
3909 2 8
http://jumperchen.blogspo... ZK Team

The issue is about the idspace issue, the window "uploadDialog" is a space owner, so the outer space owner cannot touch the upload button which is put inside another space owner. Here is a runnable example - http://zkfiddle.org/sample/1v468ar/2-basic-upload-button

You can use the following selector rule to get the upload button.

@Wire("#outer #inner #upload") private Button up;
link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2015-06-04 09:59:05 +0800

Seen: 40 times

Last updated: Jun 05 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More