The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Gucky (30) [Avatar] Offline
#1
I looked thought the book, but was not able to find the reason why the below will not work. It only submits the fields and values that exist before the winRequestForm variable gets requestForm. Firebug shows the new entries, but they never make it into the post data. I can't see a problem with the code (but please correct me) so I wonder if this is the normal behaviour and therefore should be mentioned:

Sampel code:
.... build form , display, hit button to submit to server, etc ....

function submitHandler (btn) {
var winRequestForm = Ext.getCmp( 'requestForm' );

winRequestForm.add( {
xtype : 'field',
id : 'newField'
});

Ext.getCmp( 'newField' ).setValue( 'just some text' );

winRequestForm.form.submit( {
url: 'addRequest.jsp'
});
}
jesus.garcia (463) [Avatar] Offline
#2
Re: Submitting forms that change on the fly
because the newly added field is not rendered.

winRequestForm.doLayout() after the add()
Gucky (30) [Avatar] Offline
#3
Re: Submitting forms that change on the fly
Thanks Jay,

I should have thought of it myself, need to keep in mind that doLayout is not only for the GUI but also the internal structures.
jesus.garcia (463) [Avatar] Offline
#4
Re: Submitting forms that change on the fly
the form submit will pull the data from all of the child items in the DOM, not in the container hierarchy.
Gucky (30) [Avatar] Offline
#5
Re: Submitting forms that change on the fly
I did add the
winRequestForm.doLayout();
just before doing the submit but it makes no difference.
Gucky (30) [Avatar] Offline
#6
Re: Submitting forms that change on the fly
It looks like that if the doLayout is called from within my submit handler, it will not take effect until the handler is exited.
jesus.garcia (463) [Avatar] Offline
#7
Re: Submitting forms that change on the fly
Hard to tell what you're doing dude.


see: http://www.extpaste.com/#3089