Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
IGgrid Custom validation for Textbox
posted

Hi,
As i am currently working with IGgrid, but the default validation of textbox allows the "spacebar" and enters a blank space even if you don't add any value in text box and it saves the data even if it is empty.

 This is default validation, it accepts blank space before we enter any character, so if i just press spacebar on textbox, it considers that as a value.

setting.ColumnSetting().ColumnKey("CustomerValue").EditorType(ColumnEditorType.Text).Required(true).Validation(true);



I need help for setting up custom validation for same, below is the jquery i wrote, it works for textbox but it display the message as alert, i want the message as defualt ie: "This field is required" on top of textbox

var emptyCustomerValue = ui.values.CustomerValue.trim().toLowerCase();
var isEmptySpace = emptyCustomerValue.replace(/^\s+|\s+$/g, "");
if (isEmptySpace === "") {
terminationReasonMappingGrid.showModel(terminationReasonMappingGrid.constants.commonErrorTitle, terminationReasonMappingGrid.constants.emptySpacesNotAllowed);
isClickedOnSave = false;
return false;
}

});

The above code displays it in Alert window