Hi,

I am new using gwt and i am using it with gwtext. I am having problems
submitting a form....Here is my code:



import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.RootPanel;
import com.gwtext.client.core.EventObject;
import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
import com.gwtext.client.widgets.form.FormPanel;
import com.gwtext.client.widgets.form.TextField;

public class Main implements EntryPoint{

            public void onModuleLoad() {

                         final Panel panel = new Panel();
                         final FormPanel formPanel = new FormPanel();

                         panel.setBorder(false);
                         panel.setPaddings(15);
                         formPanel.setLabelWidth(75);
                         formPanel.setBorder(false);

                         final TextField titulop = new
TextField("Titulo de la pantalla", "txtTitulo", 200);
                         titulop.setAllowBlank(false);
                         titulop.setLabelStyle("width=230");
                         formPanel.add(titulop);

                         final TextField np = new TextField("Número de
páginas", "txtNP", 200);
                         np.setAllowBlank(false);
                         np.setLabelStyle("width=230");
                         np.setRegex("^\\d*$");

                         formPanel.add(np);

                         final Button save = new Button("Save", new
ButtonListenerAdapter()

                         {

                         public void onClick(Button button, EventObject e)

                         {


//formPanel.getForm().submit("http://localhost/framework/lib/index.php?importar=bantech.clsPantalla.prueba&system=Saseg";,
null, Connection.POST, "Guardando...", false);

                         //pantalla_detalles();

                         RequestBuilder.Method method=RequestBuilder.POST;

                         final String
url1="http://localhost/framework/lib/index.php?importar=bantech.clsPantalla.prueba&system=Saseg";;

                         RequestBuilder rb=new RequestBuilder(method, url1);
                         try {
                                     rb.sendRequest(null, new
RequestCallback() {
                                     public void
onResponseReceived(Request request, Response response) {

Window.alert("Respondio "+response.getStatusCode());

                                             if (response.getStatusCode()==200){


//formPanel.getForm().submit();

                                                    pantalla_detalles();

                                               }

                                        }

                                        public void onError(Request
arg0, Throwable arg1) {

                                              Window.alert("error");

                                        }

                                       });

                         }catch (RequestException ex) {

                                Window.alert("ERROR"+ex);

                         }

               }

               private void pantalla_detalles() {
                         Panel pd = new Panel();
                         pd.setBorder(false);
                         pd.setPaddings(15);
                         FormPanel formDetalles = new FormPanel();
                         formDetalles.setFrame(true);
                         formDetalles.setTitle("Detalles de la pantalla");
                         formDetalles.setWidth(600);
                         formDetalles.setLabelWidth(75);

formDetalles.setUrl("../procesardatapantalla.php?proce=guardar_pantalla");
                         TextField pg = new TextField("Página","txtpagina",230);
                         formDetalles.add(pg);
                         pd.add(formDetalles);
                         RootPanel.get().add(pd);
                 }

           });

          formPanel.addButton(save);
          panel.add(formPanel);
          RootPanel.get().add(panel);
         }
}


The answer of the server it's in JSON format. If i use a
formPanel.getForm().submit("http://localhost/framework/lib/index.php?importar=bantech.clsPantalla.prueba&system=Saseg";,
null, Connection.POST, "Guardando...", false); instead of using
RequestBuilder the submit is perform but i need to have the answer of
the server and i read that using RequestBuilder is the only way.


Thanks in advance

--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to