Wednesday, March 30, 2011

access a <form> from a JSNI function in GWT

wohhhhhhh what an ugle stage!
Hi all, I have a .ui.xml with html code, like this:

...
<form enctype="multipart/form-data" method="post" name="fileinfo"
id="fileinfo" >
<input type="file" name="file" />
</form>
...

Then, I have a realy good code in gwt and one of the functions are a
JSNI that try to make the next thing:

var data = new FormData(document.getElementById("fileinfo"));
data.append("CustomField", "This is some extra data");
var xhr = new XMLHttpRequest();
xhr.open("POST", url, false)
xhr.send(data);

This is not work at all. And I don't know why, I'm tryng to send data
and a file to a server, and I have to make some test about CORS. I
think that I can make it like this, like the people on mozilla ... but
I can't access the Form...

Any Idea how to access a <form> from a JSNI ?!

Thanks for all.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment