This is a migrated thread and some comments may be shown as answers.

[Solved] Model error handling issues on popup edit form

1 Answer 141 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Wicky
Top achievements
Rank 1
Wicky asked on 30 Nov 2011, 03:40 AM
Hi,

I'm trying the model state error handling sample in code library (235124_modelstateerrors).
I upgraded it to 2011.3 and played with it.
I found some issues below.

1) "jquery.validate.js" version in 2011.3 is 1.8, it sometimes not working properly with "jquery.validate.unobtrusive.js", i replaced it with version 1.9 and everything seems ok

2) if I added model error with empty key, for example:  
ModelState.AddModelError("", "ModelState error added");
javascript error occured in telerik.grid.editing.js (in displayErrors function):
"Syntax error, unrecognized expression: #"
(I patched "resolveWith" in jquery-1.6.4.js to show this error message. otherwise it would say "exception thrown without catch" in visual studio debugger)

3) if I added more than one model error for same field, but only first one displayed
ModelState.AddModelError("Name", "ModelState error added for the Name property");
ModelState.AddModelError("Name", "ModelState error2 added for the Name property");
I guess it's designed behavior, but it would be better if the case could be handled.

Please find attached project to simulate issue 2) and 3).

Regards
WIcky

1 Answer, 1 is accepted

Sort by
0
Khyati
Top achievements
Rank 1
answered on 01 Feb 2013, 09:04 AM
Hi,

I am facing very weird issue while using ModelState error. Please help me.

My modelState error shows message even after error goes. This happens only if I have two strings in my model.
Scenario steps:
1) Provide no value to both the strings - Model state error would show correct errors. (two errors)
2) Provide value to one string and no value to other string - Model state error still shows two errors. Ideally It should get updated with one error only. 

Please find attached the files for reference.
I am not sure what is wrong with my files. I have tried every possible solution.

Regards,
Khyati
Tags
Grid
Asked by
Wicky
Top achievements
Rank 1
Answers by
Khyati
Top achievements
Rank 1
Share this question
or