What steps will reproduce the problem?
I've downloaded the Ext.Direct.Mvc-2.2.0 and I am trying to check whether the
data submitted is valid or not.
1. So in \Ext.Direct.Mvc.Demo\Code\Person.cs, I've changed the code to:
public class Person {
[Required]
public string Name { get; set; }
public string Email { get; set; }
public Gender Gender { get; set; }
public DateTime Birthday { get; set; }
public float Salary { get; set; }
}
2. I then modified Ext.Direct.Mvc.Demo\Controllers\TestController.cs to:
public ActionResult EchoPerson(Person person)
{
if( ModelState.IsValid )
{
return this.Direct( person, new JavaScriptDateTimeConverter(), new StringEnumConverter() );
}
return null;
}
3. Finally in Ext.Direct.Mvc.Demo\Source\SimpleTestPanel.js, I've changed the
onEchoPerson to:
onEchoPerson: function() {
var person = {
Name: '',
Email: 'john.smith@example.com',
Gender: 'Male',
Birthday: new Date('12/31/1969'),
Salary: 55000
};
Test.EchoPerson(person, function(result, response) {
var tpl = new Ext.Template(
'Name: {Name}<br/>',
'Email: {Email}<br/>',
'Gender: {Gender}<br/>',
'Birthday: {Birthday:date(m/d/Y)}<br/>',
'Salary: {Salary:usMoney}'
);
this.updateBody(tpl.apply(result));
}, this);
}
What is the expected output? What do you see instead?
I expect that ModelState.IsValid to be false.
What version of the product are you using? On what operating system?
2.2.0. Windows 7 Ultimate 64 bits.
Please provide any additional information below.
I have also tried using TryUpdateModel(person) in the TestController but this
causes all the properties e.g. Gender, Birthday, Salary, which are not strings
to be reported back as being required!.
Original issue reported on code.google.com by davids...@sky.com on 18 Aug 2011 at 12:47
Original issue reported on code.google.com by
davids...@sky.com
on 18 Aug 2011 at 12:47