[CLOSED] [#139] FormPanel does not detect dynamically-loaded fields

  1. #1

    [CLOSED] [#139] FormPanel does not detect dynamically-loaded fields

    I am trying to load fields into a FormPanel dynamically using a ComponentLoader without auto-load. The form renders properly; however, if I attempt to call getFields or getValues,my dynamic input elements are not detected. The problem is that calling submit() does not include the dynamically-added form elements. I believe this was working before switching to the SVN trunk version. I also noticed that FormPanel generates a div tag instead of a form tag. I am not sure if this is intended behavior.

    My intention is to dynamically load controls into a FormPanel via JavaScript, and later submit the form via JavaScript. Currently I am trying to inject a TabPanel with various form controls embedded inside in different Panels with various layouts. To help solve this problem I am providing a concise example of the problem.


    public ActionResult Index()
        return View();
    public ActionResult Form()
        return new Ext.Net.MVC.PartialViewResult {
            ContainerId = "FormContainer",
            ClearContainer = true,
            RenderMode = Ext.Net.RenderMode.AddTo,
            WrapByScriptTag = false,
            ViewName = "Form"

                        .Text("Get Fields")


                            .Name("Test 2")
    Last edited by Baidaly; Mar 15, 2013 at 2:33 AM. Reason: [CLOSED]
  2. #2

    You have to reset form fields:

    	.OnClientClick("Ext.getCmp('Form').getLoader().load(); Ext.getCmp('Form').getForm()._fields = null;")
  3. #3
    Hi everybody,

    I think it is a bug. Reported to Sencha.

    For now please use the workaround suggest by @Baidaly.

    Or remove an interim "FormContainer" Panel and add items directly to the FormPanel.
  4. #4
    Sencha opened a bug.

    We created an Issue to monitor this defect.
  5. #5


    Thank you, and I appreciate the investigation! I have resolved the issue by implementing the workaround supplied in a load listener attached to the ComponentLoader. My form now detects the dynamically-added elements and submits the correct data.

    Feel free to mark this post as closed.
  6. #6
    Thank you for the confirming that the workaround works for you.

    We will keep the thread opened till Sencha fix it and we incorporate the fix into our sources.

    Thank you again for the report.
  7. #7
    It should be fixed in SVN and included to the next release (v2.2).

Similar Threads

  1. Replies: 1
    Last Post: Oct 10, 2012, 11:47 AM
  2. Unloading dynamically loaded UserControls
    By bright in forum 1.x Help
    Replies: 1
    Last Post: Mar 14, 2012, 6:37 PM
  3. [CLOSED] Managing events from a dynamically loaded UserControl
    By egvt in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Feb 20, 2012, 4:49 PM
  4. Replies: 20
    Last Post: Feb 23, 2011, 5:49 PM
  5. Replies: 2
    Last Post: Feb 10, 2010, 10:45 AM

Posting Permissions