[CLOSED] parsedResponse.result - Error on form submit with file upload field

  1. #1

    [CLOSED] parsedResponse.result - Error on form submit with file upload field

    Hi there,

    I have a partial view that contains a form, within the form is a file upload field which handles the uploading of files seperately, on submitting the form I am getting

    TypeError: parsedResponse.result is undefined
    
    ...cope.parseResponse(response,options);if(!Ext.isEmpty(parsedResponse.result.docum...
     
         
    ext.axd?v=33683 (line 128, col 62)
    The Controller code is

    namespace Ext.Net.MVC.Sample.Controllers
    {
        [DirectController(AreaName = "Events")]
        public class ExtNetController : Controller
        {
            
    
            public ActionResult Index()
            {
    
                ExtNetModel model = new ExtNetModel()
                {
                    WindowTitle = "ERROR",
                    TextAreaEmptyText = ">> Enter a Message Here <<",
                    sME = "Steven McCullie"
                };
                string sUser = "Steven McCullie";
                X.GetCmp<ToolbarTextItem>("sUser").Text = sUser;
    
                return View();
            }
    
    
    
            #region Counterparties
    
            public PartialViewResult CounterpartiesOld(string containerId)
            {
                return new PartialViewResult
                {
                    ContainerId = containerId,
                    ViewName = "Counterparties4",
                    WrapByScriptTag = false
                };
            }
    
    
    
            public ActionResult UpdateIdentity(FormCollection values, string user)
            {
    
                    // alert to user to show that identity has been updated
                    X.Msg.Notify("Counterparty Ammended", values["ComplianceNote"]).Show();
    
                return this.Direct();                   // parser error here....
            }
    
    
        }
    }
            #endregion
    The partial view is
    @{
        ViewBag.Title = "Counterparties4";
    }
    <div>
    
    @(
    Html.X().Panel()
    .Layout(LayoutType.Border)
    .MinWidth(1500)
    .Height(810)
    .Items(
    
                Html.X().Panel()
                .Region(Region.Center)
                .MinWidth(1000)
                .Flex(2)
                .AutoScroll(true)
                .Items(
                    Html.X().TabPanel()
                        .Title("Counterparty Details")
                        .ID("CounterpartyDetailTabs")
                        .Items(
                            Html.X().Panel()
                            .Title("Identity")
                            .ID("IdentityTab")
                            .Border(false)
                            .Items(
                            Html.X().FormPanel()
                            .AutoScroll(true)
                            .Layout(LayoutType.HBox)
                            .Items(
                                Html.X().FormPanel()
                                .Layout(LayoutType.Border)
                                .Width(950)
                                .Height(800)
                                .ID("IdClientInfo")
                                .Items(
                                 
                            Html.X().FieldSet()
                            .Border(false)
                            .Height(700)
                            .Width(950)
                            .Padding(0)
                            .MarginSpec("5 5 5 0")
                            .Region(Region.South)
                            .Items(
                            Html.X().FieldSet()
                            .Title("Counterparty Files")
                            .Height(600)                                                        
                            .Width(475)
                            .Region(Region.East)
                            .Items(
                                     Html.X().FileUploadField()
                                    .FieldLabel("Upload File Attachments")
                                    .Name("FileAttachment")
                                    .ID("FileAttachment")
                                    .Padding(5)
                                    .Width(430)
                                )
                                    ,
                                    Html.X().FieldSet()
                            .Border(false)
                            .Width(950)
                            .Region(Region.South)
                            .Items(
                                Html.X().Button()
                                .Text("Save Changes")
                                .Icon(Icon.Lightning)
                                .Height(50)
                                .Padding(5)
                                .DirectEvents(de =>
                                    {
      
                                        de.Click.Url = Url.Action("UpdateIdentity");
                                        de.Click.ExtraParams.Add(new Parameter("values", "this.up('form').getForm().getValues(true)", ParameterMode.Raw));
                                        de.Click.ExtraParams.Add(new Parameter("User", "X.getElementById(\"sUser\").innerHTML", ParameterMode.Raw));
                                    }
                                )
                                    )
                                )
                            )      
                        )   
                    )
                )
            )                                                                               
        )
    )
            </div>
    The index.cshtml file which holds the partial view is

    @*@model Ext.Net.MVC.Sample.Models.ExtNetModel*@
    @model System.Collections.IEnumerable
    @using OMS.Models
    <!DOCTYPE html>
    
    <html>
    
    <head>
    
    
    <script src="../../JS/CounterpartyTab.js" type="text/javascript"></script>
      
    </head>   
          
    <body>
        @Html.X().ResourceManager()
    
    
      
    
      
            @(
    Html.X().Viewport()
    
        .Layout(LayoutType.VBox)
                .LayoutConfig(
                    new VBoxLayoutConfig { Align = VBoxAlign.Stretch }
                )
    
        .Items(regions =>
            {
                regions.Add(Html.X().Panel()
                        .ItemID("north")
                        .Height(27)
                        .Header(false)
                        .Border(false)
                    .TopBar(Html.X().Toolbar().Items(items =>
                    {
                        items.Add(new ToolbarTextItem { Text = "You are logged in as:" });
                        items.Add(new ToolbarTextItem { ID = "sUser", Text = "" });
                        items.Add(new ToolbarSpacer());
    
                    }
                    )
                    )
                        )
                        ;
                 regions.Add(Html.X().TabPanel()
                    .Flex(1)
                    //.ActiveTabIndex(3)
                    .Items(tabs =>
                    {
                        
    
                        // Counterparty tab page
                        tabs.Add(Html.X().Panel()
                            .Title("Counterparties")
                            .Layout(LayoutType.HBox)
                            .LayoutConfig(new HBoxLayoutConfig { Align = HBoxAlign.Stretch })
    
                             .Items(blag =>
                               {
                                   blag.Add(
                                   Html.X().Container()
                                   .ID("counterpartiesOld")
                                   .StyleSpec("border:solid 1px black;")
    
                                   .Border(false)
                                   .Loader(Html.X().ComponentLoader()
                                   .Url(Url.Action("CounterpartiesOld"))
                                   .Mode(LoadMode.Script)
                                   .Params(new { containerId = "counterpartiesOld" })
                                          )
                                           );
                               }
                                 )
                            );
    
                       
                                })
                            );
                    
                
            }
    
                )
    )
    
         
    </body>
    </html>
    Thanks
    Last edited by Daniil; Jan 13, 2015 at 8:46 AM. Reason: [CLOSED]
  2. #2
    Hello,

    Unfortunately I cannot run your code. Can you please narrow down your sample a bit and make sure it builds and runs autonomously? (And I think you can spare the partial view since it does not seem to be part of the problem).

    As a side note, shouldn't there be a form tag like:
    <form id="form1" enctype="multipart/form-data">
  3. #3
    Hi,

    No need for the form tags, the submit works perfectly when the file upload field is not present.

    What compile error are you getting? The partial view is where there form is so this is required although I could move to the index file if I thought that wasnt an issue.

    To create your own, make a form with the file upload field and one other value with a submit button, you will find (or at least I have) that the file upload field causes the parser error when the submit button is clicked.
  4. #4
    IsUpload should be set to true for a DirectResult, if there is an upload operation.

    Please try:
    public ActionResult UpdateIdentity(FormCollection values, string user)
    {
        // alert to user to show that identity has been updated
        X.Msg.Notify("Counterparty Ammended", values["ComplianceNote"]).Show();
        DirectResult r = new DirectResult { IsUpload = true };
    
        return r;
    }
  5. #5
    Thanks Daniil,

    Please mark this thread as closed.

Similar Threads

  1. [CLOSED] Error on Form Submit - parsedResponse.result
    By OriCoder in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Dec 16, 2014, 1:08 PM
  2. [CLOSED] File Upload Field example
    By aguidali in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 20, 2014, 11:44 AM
  3. File upload field form redirect to another razor
    By chinninani in forum 2.x Help
    Replies: 2
    Last Post: Jun 27, 2013, 9:12 AM
  4. Replies: 1
    Last Post: Mar 15, 2013, 1:38 AM
  5. [CLOSED] File Upload Field
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Mar 30, 2010, 7:24 PM

Tags for this Thread

Posting Permissions