<ej:Grid ID="OrdersGrid" runat="server" AllowPaging="True" OnServerEditRow="EditEvents_ServerEditRow" OnServerAddRow="EditEvents_ServerAddRow" OnServerDeleteRow="EditEvents_ServerDeleteRow"> <ClientSideEvents ActionComplete="complete" EndAdd="endAdd" EndDelete="endDelete" EndEdit="endEdit" /> <Columns> <ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="true" TextAlign="Right" Width="90"> <ValidationRule> <ej:KeyValue Key="required" Value="true" /> <ej:KeyValue Key="number" Value="true" /> </ValidationRule> </ej:Column> <ej:Column Field="CustomerID" HeaderText="Customer ID" Width="90"> <ValidationRule> <ej:KeyValue Key="required" Value="true" /> <ej:KeyValue Key="minlength" Value="3" /> </ValidationRule> </ej:Column> <ej:Column Field="Freight" HeaderText="Freight" TextAlign="Right" Width="80" Format="{0:C}" EditType="Numeric"> <NumericEditOptions DecimalPlaces="2"></NumericEditOptions> </ej:Column> <ej:Column Field="ShipName" HeaderText="ShipName" Width="110"></ej:Column> <ej:Column Field="ShipCountry" HeaderText="ShipCountry" Width="90" EditType="Dropdown" /> </Columns> <EditSettings AllowEditing="True" AllowAdding="True" AllowDeleting="True" EditMode="Dialog"></EditSettings> <ToolbarSettings ShowToolbar="True" ToolbarItems="add,edit,delete,update,cancel"></ToolbarSettings> </ej:Grid> |
<script src="Scripts/jquery.validate.min.js"></script> |
Regards,
Jayaprakash K.
Hi Oscar,
We have analyzed your sample and found that you had not referred to jquery.validate.min.js and jquery.validate.unobtrusive.min.js scripts in your sample. These two files are mandatory for validation. So, please refer to these script files in your sample. Also refer to the below code example and help documentation link.
CodeExample:
<script src="Scripts/jquery.validate.min.js"></script>
<script src="Scripts/jquery.validate.unobtrusive.min.js"></script>
Help Documentation: http://help.syncfusion.com/aspnetmvc/grid/editing#validation
Regards,
Jayaprakash K.
Hello guys im trying the same thing but using the maskedit control<ej:MaskEdit ID="sfTextboxReportName" runat="server" Width="100%" WatermarkText="Enter the Report Name"><ValidationRule><ej:KeyValue Key="required" Value="true" /></ValidationRule><ValidationMessage><ej:KeyValue Key="required" Value="Need to enter a report Name" /></ValidationMessage></ej:MaskEdit>But when i run the page it doesn't run the validation,when does it need to run the validation? when leaving focos of the control or when clicking a ej:button?my reference as the documentation states<script src="Scripts/jquery.validate.min.js" type="text/javascript"></script>this one is included when i create the solution using the visual studio template for syncfusion c#.My current version of EJ is 14.1460.0.46
$.validator.setDefaults({
//to validate all fields(hidden also)
ignore: [],
//if we don’t set custom class, default “error” class will be added
errorClass: 'e-validation-error',
//it specifies the error message display position
errorPlacement: function (error, element) {
$(error).insertAfter(element.closest(".e-widget"));
}
}); |
Hi Gabriel,We have checked with your query” The MaskEdit validates but when typing in a value the error message does not go away unless hit the submit button” and created a new incident(I157912) under your account to track the status of the issue reported in this forum.Please log on to our support website to check for further updates.Regards,Sureshkumar P
<code>
$.validator.setDefaults({
//to validate hidden fields with e-form-validate class
ignore: ":hidden:not(input.e-form-validate)",
//if we don’t set custom class, default “error” class will be added
errorClass: 'e-validation-error',
//it specifies the error message display position
errorPlacement: function (error, element) {
$(error).insertAfter(element.closest(".e-widget"));
}
</code> |
<code>
function activetab()
{
$("#MainContent_Tab1").find(".e-form-validate").removeClass("e-form-validate");
$("#MainContent_Tab1").find(".e-active-content").find("input:hidden").addClass("e-form-validate");
}
</code>
|