PDA

View Full Version : [CLOSED] Error on Form Submit - parsedResponse.result



OriCoder
Dec 12, 2014, 1:28 PM
I am having a similar problem on a couple of forms that #i have in my web app, firebug returns:


TypeError: parsedResponse.result is undefined




...cope.parseResponse(response,options);if(!Ext.is Empty(parsedResponse.result.docum...


ext.axd?v=33683 (line 128, col 62)

A sample form view is

@(Html.X().Window()
.Width(478)
.Height(600)
.Icon(Icon.ApplicationFormAdd)
.Title("Trade Loss - Additional Notes")
.ID("TradeLossAdditionalNotesWindow")
.Padding(10)
.X(400)
.Y(150)
.CloseAction(CloseAction.Destroy) // NEED TO MAKE THIS THE SAVE FUNCTION??
.Items(
Html.X().FormPanel()
.Layout(LayoutType.VBox)
.ID("TradeLossForm")
.LayoutConfig(new VBoxLayoutConfig { Align = VBoxAlign.StretchMax })
.Items(
Html.X().Label()
.Text("Please give further information of recorded loss.")
.Margin(5)
,
Html.X().FieldContainer()
.Width(450)
.MarginSpec("5 5 5 0")
.Padding(5)
.Items(
Html.X().Label().Text("Additional Notes:").Width(370).Padding(5),
Html.X().TextArea().ID("AdditionalNote").Width(445).Padding(5)
)
,
// submit button
Html.X().FieldContainer()
.Width(300)
.MarginSpec("5 5 5 0")
.Padding(5)
.Items(
Html.X().Button()
.Text("Submit")
.DirectEvents(de =>
{
de.Click.Url = Url.Action("setTradeLossAdditionalNote");
de.Click.ExtraParams.Add(new Parameter("AdditionalNote", "App.AdditionalNote.getValue()", ParameterMode.Raw));
// extra params int RIABargainRef, string AdditionalNote
de.Click.Success = "App.TradeLossAdditionalNotesWindow.Close();";
}
)

)
)
)
)

the controller code is


public ActionResult setTradeLossAdditionalNote( string AdditionalNote) {

TradeLossReason TradeLossReason;

try
{
TradeLossReason = (from ofg in db.TradeLossReason
select ofg).First<TradeLossReason>();

TradeLossReason.AdditionalNote = AdditionalNote;

// save changes to DB
db.SaveChanges();
}

catch (InvalidOperationException e)
{

TradeLossReason = new TradeLossReason();
TradeLossReason.Reason = 4; // set this to additional note
TradeLossReason.AdditionalNote = AdditionalNote;

// add to DB and save changes
db.TradeLossReason.Add(TradeLossReason);
db.SaveChanges();

}

// Notify user of change
X.Msg.Notify("Trade Loss Reason", "Additional Notes saved").Show();

return this.Direct();
}

Also, as an aside, what is the best way of closing the window once the details have been submitted?

Thanks

Daniil
Dec 12, 2014, 9:41 PM
Hi @OriCoder,

Unfortunately, I cannot run the test case. Could you, please, change it that we are able to copy, paste and run it?


Also, as an aside, what is the best way of closing the window once the details have been submitted?

I see you try to use a Success handler. It is exactly what I would recommend to try at first. There is ".Close()" in your code. It should start with a lowercase "c" - ".close()".

OriCoder
Dec 16, 2014, 9:40 AM
Sorry, I find it difficult to give simple but working examples - Its a pretty big application...

using firebug I've found that in other areas of the app that submit successfully have values for the variables passed in to the function on line 128 of ext.axd?v=33683 while the forms which don't have no values, I've put some screen shots in which hopefully help in demonstrating this.

1724117242

Daniil
Dec 16, 2014, 1:08 PM
Sorry, I find it difficult to give simple but working examples - Its a pretty big application...

Yes, it might be not easy. This technique might help.
How to prepare a sample (http://forums.ext.net/showthread.php?13672&p=56687&viewfull=1#post56687)

As for the screenshots, thank you for posting them, but, unfortunately, it didn't help me to narrow down the problem.