Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select type validate required not working in jsgrid #1435

Open
chandranmanikandan82 opened this issue Feb 6, 2024 · 0 comments
Open

Select type validate required not working in jsgrid #1435

chandranmanikandan82 opened this issue Feb 6, 2024 · 0 comments

Comments

@chandranmanikandan82
Copy link

I am using country and state master with jsgrid in php mysql database, In state php call country master dropdown with country id name field and state name text field. Validate required syntax is not working in country_id field. The script is below. Appreciate anyone help this issue.
$(function() {
$.ajax({
type: "GET",
url: "countries_drop.php"
}).done(function(countries) {
countries.unshift({ Country_Id: "0", Country_Name: "" });
$('#States_table').jsGrid({

width: "100%",
height: "600px",

filtering: true,
inserting:true,
editing: true,
sorting: true,
paging: true,
autoload: true,
pageSize: 10,
pageButtonCount: 5,
deleteConfirm: "Do you really want to delete data?",

controller: {
loadData: function(filter){
return $.ajax({
type: "GET",
url: "states.php",
data: filter
});
},
insertItem: function(item){
return $.ajax({
type: "POST",
url: "states.php",
data:item
});
},

updateItem: function(item){
return $.ajax({
type: "PUT",
url: "states.php",
data: item
});
},
deleteItem: function(item){
return $.ajax({
type: "DELETE",
url: "states.php",
data: item
});
},
},

fields: [
{
autosearch: true,
name: "Country_Id",
title: "Country",
type: "select",
width: 100,
items: countries,
valueField: "Country_Id",
textField: "Country_Name" ,
align: "left",
//selectedIndex: -1,
validate: "required"
},
{
name: "State_Id",
type: "hidden",
css: 'hide'
},
{
name: "State_Name",
type: "text",
width: 150,
validate: "required"
},
{
type: "control"
}
]

});
});

});

I tried to insert state name without country code selection showing blank in the inserted row for country field, so i want to validate country selection before insert the record by user

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant