I am trying to get a cross domain solution working using Ray
Cromwell's solution. Has anyone gotten this to work with GWT 1.6?
Any samples out there showing how it is supposed to be wired up.
I can't seem to get the post result to be available in the
application. When the FormPanel creates the iframe, it is
automatically setting the window.name of the iframe. No matter what I
try (see below) the only value I am getting in my:
form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler(){
public void onSubmitComplete(SubmitCompleteEvent event){
Window.alert("return:" + event.getResults());
}
});
Is the preset iframe window.name. Something like FormaPanel_1.
I've tried having the servlet on the cross domain return variations
of:
<script>...</script>
<html><script>...</script></html>
<html><head><script>...</script><head></html>
Any ideas on what I could be doing wrong?
The two reference articles I have been using:
http://timepedia.blogspot.com/2008/07/cross-domain-formpanel-submissions-in.html
http://development.lombardi.com/?p=611
Thanks,
Chris.....
My sample code:
public class Zwidget2 implements EntryPoint{
FormPanel form;
public void onModuleLoad(){
final Button sendButton = new Button("Send To Cross Domain");
RootPanel.get("btn4").add(sendButton);
class MySendHandler implements ClickHandler{
public void onClick(ClickEvent event){
if(form != null) {
RootPanel.get("form1").remove(form);
}
form = new FormPanel();
form.setAction("http://crossdomain.com/zwidget2/greet2");
form.setMethod(FormPanel.METHOD_POST);
Hidden h = new Hidden();
h.setValue(variable());
h.setName("inputvalue");
form.add(h);
form.addSubmitHandler(new FormPanel.SubmitHandler(){
public void onSubmit(SubmitEvent event){
Window.alert("submit form with value[" + variable()
+ "] to url[" + form.getAction() + "]");
}
});
form.addSubmitCompleteHandler(new
FormPanel.SubmitCompleteHandler(){
public void onSubmitComplete(SubmitCompleteEvent event)
{
Window.alert("return:" + event.getResults());
}
});
RootPanel.get("form1").add(form); //form needs to be
attached to send
DeferredCommand.addCommand(new Command(){
public void execute(){
Window.alert("submit");
form.submit();
}
});
}
}
sendButton.addClickHandler(new MySendHandler());
}
public native String variable()/*-{
return $wnd.__myVariable; //set by another javascript script
}-*/;
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---