Jan 29, 2013, 5:40 PM
[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.
Controller
Form.cshtml
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.
Controller
public ActionResult Index()
{
return View();
}
[HttpGet]
public ActionResult Form()
{
return new Ext.Net.MVC.PartialViewResult {
ContainerId = "FormContainer",
ClearContainer = true,
RenderMode = Ext.Net.RenderMode.AddTo,
WrapByScriptTag = false,
ViewName = "Form"
};
}
Index.cshtml
@(Html.X().FormPanel()
.ID("Form")
.Loader(Html.X().ComponentLoader()
.Url(Url.Action("Form"))
.AutoLoad(false)
.Mode(LoadMode.Script)
)
.TopBar(Html.X().Toolbar()
.Items(
Html.X().Button()
.Text("Load")
.OnClientClick("Ext.getCmp('Form').getLoader().load()"),
Html.X().Button()
.Text("Get Fields")
.OnClientClick("console.log(Ext.getCmp('Form').getForm().getFields())")
)
)
.Items(
Html.X().Panel()
.ID("FormContainer")
)
)
Form.cshtml
@(Html.X().TabPanel()
.BodyPadding(10)
.Items(
Html.X().Panel()
.Title("Test")
.Items(
Html.X().ComboBox()
.Name("Test 2")
)
)
)
Last edited by Baidaly; Mar 15, 2013 at 2:33 AM.
Reason: [CLOSED]