Aug 15, 2013, 4:40 PM
[CLOSED] Field Errors help
Just in case someone recognizes this and/or knows off hand what I need to include in order to fix this, I'm not putting full sample code in yet. If a sample is needed I will post it.
I am using MVC Razor.
I was following the Models > Submit example (http://mvc.ext.net/#/Models/Submit/) for displaying validation messages that come back from a data service. I have parsed the message and successfully filled a FieldErrors collection. Here is some of the code I'm using:
Again - in case it's something silly on my part, I'm posting without full code sample, but I will provide a full sample if needed.
I am using MVC Razor.
I was following the Models > Submit example (http://mvc.ext.net/#/Models/Submit/) for displaying validation messages that come back from a data service. I have parsed the message and successfully filled a FieldErrors collection. Here is some of the code I'm using:
@(Html.X().FormPanel()
.ID("Form1")
.BodyPadding(5)
.FieldDefaults(def =>
{
def.MsgTarget = MessageTarget.Side;
})
.Buttons(
Html.X().Button()
.Text("Submit")
.DirectEvents(de =>
{
de.Click.Url = Url.Action("Submit");
de.Click.EventMask.ShowMask = true;
de.Click.FormID = "Form1";
})
)
.Items(
Html.X().TextFieldFor(m => m.Fund.ShortName).FieldLabel("Short Name"),
Html.X().TextFieldFor(m => m.Fund.LegalName).FieldLabel("Legal Name"),
Html.X().TextFieldFor(m => m.Fund.Cusip).FieldLabel("Cusip"),
Html.X().ComboBoxFor(m => m.Fund.FundStructure)
.FieldLabel("Fund Structure")
.Store(
Html.X().StoreFor(m => m.FundStructures)
)
.ValueField("FundStructureId")
.DisplayField("Description")
)
)
public ActionResult Submit(Fund fund)
{
try {
...
}
catch (DataServiceRequestException dse)
{
string fieldId;
string errorMessage;
var fieldErrors = new FieldErrors();
...
foreach (XElement error in errors)
{
fieldId = "Fund_" + error.Element("Field").Value;
errorMessage = error.Element("Error").Value;
fieldErrors.Add(new FieldError(fieldId, errorMessage));
}
return this.FormPanel(fieldErrors);
}
return this.Direct()
)
When the response is sent to the view, however, instead of marking the fields as invalid and showing the error message, I get this:Again - in case it's something silly on my part, I'm posting without full code sample, but I will provide a full sample if needed.
Last edited by Daniil; Aug 27, 2013 at 4:57 AM.
Reason: [CLOSED]