How to simulate HTML button click from qooxdoo?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to simulate HTML button click from qooxdoo?

Dalmazio Brisinda
Hello,

I'm wondering how to simulate an HTML button click through qooxdoo? I have an <input type="file"...> element within a <form...> element. What I want to do is place a qooxdoo button that will behave as if the user clicked on the "Browse" button of the <input type="file"...> element.

I've added an Iframe containing the following HTML (which works independently):

<div id="addImageDiv">
    <form id="addImageForm" name="uploadImageForm" method="post" action="../cgi/upload_image.php" enctype="multipart/form-data">       
        <p>Choose an image to upload.</p>       
        <p><input id="addImageBrowseButton" type="file" name="image_file" accept="image/png"></p>
        <p><input id="addImageSubmitButton" type="submit" value="Upload It!"></p>
    </form>   
</div>


And then in my JavaScript class file I have the following:

// Set up the Iframe
var iframeBox = new qx.ui.layout.HorizontalBoxLayout();
iframeBox.setVisibility(false);
var iframe = new qx.ui.embed.Iframe();
iframe.setSource("resource/html/fileChooser.html");  // the above HTML
iframeBox.add(iframe);            
myLayout.add(iframeBox);


// Make qx button simulate the "Browse" button in the HTML form followed by the "Submit" button
this.addImageButton = new qx.ui.form.Button("Add Image...");
this.addImageButton.addEventListener("execute", function(e) {
    document.getElementById("addImageBrowseButton").click();   // bring up the file chooser dialog
    document.getElementById("addImageSubmitButton").click();   // submit the form
});
buttonBox.add(this.addImageButton);
myLayout.add(buttonBox);


But I'm getting the following errors from Firebug when I click on the qooxdoo button:

"document.getElementById("addImageBrowseButton") has no properties"

It's as if qooxdoo is not recognizing the id tags I've specified in the HTML.

Any ideas?

Best,
Dalmazio






Reply | Threaded
Open this post in threaded view
|

Re: How to simulate HTML button click from qooxdoo?

Dioc

Hello Dalmazio,

There is UploadWidget in qooxdoo-contrib.
See
http://qooxdoo.org/documentation/contrib
and
http://qooxdoo-contrib.svn.sourceforge.net/viewvc/qooxdoo-contrib/trunk/qooxdoo-contrib/UploadWidget/
for details.
Maybe it will help you.

Best regards,
Denis

--
View this message in context: http://www.nabble.com/How-to-simulate-HTML-button-click-from-qooxdoo--tp18558002p18563647.html
Sent from the qooxdoo-devel mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to simulate HTML button click from qooxdoo?

Andreas Ecker
Hi,

just an additional wrap-up about how easy it is to include a widget from
qooxdoo-contrib:

Add the contribution to the Makefile of your application:
APPLICATION_INCLUDES = contrib://UploadWidget/0.1

You then simply use the widget in your application code. Once you do a
"make" it gets automatically resolved and included.
http://qooxdoo.org/documentation/contrib/using_contributions

It doesn't really make a difference if a widget is included in the
framework or in the contributions.

Bye,

Andreas



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to simulate HTML button click from qooxdoo?

Dalmazio Brisinda
In reply to this post by Dioc
Hello Dennis,

Many thanks for the link -- it worked like a charm!

Best,
Dalmazio



Dioc wrote
Hello Dalmazio,

There is UploadWidget in qooxdoo-contrib.
See
http://qooxdoo.org/documentation/contrib
and
http://qooxdoo-contrib.svn.sourceforge.net/viewvc/qooxdoo-contrib/trunk/qooxdoo-contrib/UploadWidget/
for details.
Maybe it will help you.

Best regards,
Denis

--
View this message in context: http://www.nabble.com/How-to-simulate-HTML-button-click-from-qooxdoo--tp18558002p18563647.html
Sent from the qooxdoo-devel mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to simulate HTML button click from qooxdoo?

Dalmazio Brisinda
In reply to this post by Andreas Ecker
Thanks Andreas, your note helped me to get up and running in no time.

Best,
Dalmazio



Andreas Ecker wrote
Hi,

just an additional wrap-up about how easy it is to include a widget from
qooxdoo-contrib:

Add the contribution to the Makefile of your application:
APPLICATION_INCLUDES = contrib://UploadWidget/0.1

You then simply use the widget in your application code. Once you do a
"make" it gets automatically resolved and included.
http://qooxdoo.org/documentation/contrib/using_contributions

It doesn't really make a difference if a widget is included in the
framework or in the contributions.

Bye,

Andreas



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel