View Full Version : Form vals to server via AJAX

22 Apr 2007, 7:32 PM
This isn't working:

loginForm.addButton('Log In', function(){

Am I even on the right track for how to do this, or is there another way?

22 Apr 2007, 9:28 PM
This is what I have done to send data from the client to the server

this.form = new Ext.form.Form({url: 'AddSerial.aspx'});
... Create text fields etc ...

This is the button click function
this.addSerial = function() {
this.form.submit({waitMsg: 'Please wait...'});

All the text fields are sent in the submit. You can then do validation on the server and send a response that says whether the submit was valid. I think there is documentation or a thread on it somewhere but as an example, if I have a failure I might send this:

{ success: false, errors: {email: 'The email address is already in use'} }

and for success

{ success: true }

23 Apr 2007, 4:32 AM
Jack (and the Ext team),

most of the posts I found in searching for form submission were like steven's above (which I appreciate Steven!) - "I think you can do it this way." "You might be able to do it that way."

I know forms are relatively new, but a good solid example for best practices for validating form data, sending via AJAX and capturing the server response would likely be helpful to many of us.

Thank you all for the continued extraordinary work!

Found a couple of good threads. Won't be able to test them out for myself until much later today, but thought it might help others:


23 Apr 2007, 8:21 AM
^^^ thanks for the posts. been wrangling w/ this myself. Things are so much easier w/ examples to rip from :)