Mar 21, 2014, 10:20 AM
[CLOSED] Range data annotation not working with Textfiled
Hi,
Mine is a Asp.Net MVC Razor view application.
Following is model
My requirement is to use a textfield.
Kindly provide inputs for the above.
Thanks.
Mine is a Asp.Net MVC Razor view application.
Following is model
public class ForValidation
{
[Range(1, 100, ErrorMessage = "Invalid range")]
public decimal? AmtColumn { get; set; }
}
Following is my view<script>
var validate = function (btnSub) {
var form = btnSub.up('form');
if (form.isValid()) { }
else
return false;
return true;
};
</script>
@(Html.X().FormPanel()
.ID("pnlAddRecord")
...
...
Html.X().TextFieldFor(m => m.AmtColumn)
...
...
.Buttons(
Html.X().Button()
.ID("btnSubmit")
.DirectEvents(de =>
{
de.Click.Url = (Url.Action("ActionMethodName", "ControllerName"));
de.Click.EventMask.ShowMask = true;
de.Click.Before = "return validate(this)";
de.Click.FormID = "pnlAddRecord";
})
)
...
...
The issue I am facing is -> range validation is not working for textfield. But if I use a Numberfield as shown in the following url it works. http://mvc.ext.net/#/Models/Data_Annotations/My requirement is to use a textfield.
Kindly provide inputs for the above.
Thanks.
Last edited by Daniil; Mar 21, 2014 at 1:56 PM.
Reason: [CLOSED]