IGgrid Custom validation for Textbox
New DiscussionHi,
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
Sign In
to post a reply
Replies
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Favorites
0 Replies
5 Created On
Jun 11, 2024 Last Post
1 year, 8 months ago 