View Full Version : insert a hidden into Html.form

1 Nov 2010, 2:39 AM
I'd like to add a hidden input control into the html.form element, but I could not figure out how to.
any help is appreciated.

I am using the hidden to store the data-store changes, I need it to be submitted to the asp.net-mvc action method.

1 Nov 2010, 2:53 AM
A bit more detail please.

Are you talking about plain a <form> element, a FormPanel or a BasicForm.

1 Nov 2010, 2:58 AM
plain html form element. I need the hidden input to be submitted with the form. (it is goint to carry data-store changes)

1 Nov 2010, 3:04 AM
You can use Ext.Element.createChild to create an <input type="hidden">.

But you could also use Ext.Ajax request, specify the <form> tag as the 'form' config option and add 'params'.

1 Nov 2010, 3:21 AM
My problem was with Ext'ifying the form object I guess. This code works fine now;

var form = Ext.get(Ext.query("form")[0].id);
form.createChild("<input type='hidden' id='hdnExtStoreData' name='hdnExtStoreData'/>");

8 Nov 2010, 12:42 AM
all of a sudden, this is not working, id is returning null.

8 Nov 2010, 1:46 AM
For starters, I would use:

var form = Ext.select('form', true).first();

8 Nov 2010, 6:57 AM
this works, thx Condor.