PDA

View Full Version : How to Reference Data in My Form



haden
4 May 2011, 12:37 PM
I have a form that loads a record from my database using the form's load method.


client_form.getForm().load({url:'get_client2.php',params:{suite_no: suite.getValue()}});

Now I'd to pass a field that isn't shown in the form (but I see is returned in the response - it's a row id) back to the server when I submit the form. I'd also like to format a date on the client side before submitting the form.

What would be the syntax for this? Is this best performed within the submit method?

friend
5 May 2011, 3:53 AM
Add a hidden field to your form panel where the name attribute matches the desired row ID field name. The hidden field will be loaded/submited just like your other fields.



{
xtype: 'hidden',
name: 'rowID'
}

As for dates, they default to a format of 'mm/dd/yyyy' on submit.

See this thread for more info:Submit Datefield in separate format (http://www.sencha.com/forum/showthread.php?98481-Submit-datefield-in-separate-format)

haden
5 May 2011, 5:48 AM
The 'hidden' xtype does it! As for the DateField, I'll format it on the server for now.
Thanks friend.

friend
5 May 2011, 6:38 AM
I concur on server-side formatting of submitted dates; I've always found it easier to do on the back-end...