
AndyLouSeer - 2009-03-16 11:50:38
Hi again. I've moved on to validating user changes to values in a displayed grid.
It appears that this is not working as per ExampleGrid5.php.
Using this example script:
<script type="text/javascript">
var thegrid = new drasticGrid('grid1', {
pathimg:"img/",
pagelength: 10,
//renamecols: {"Continent":"Cont", "LocalName":"LN"}
//the renamecols option is no longer supported; instead use this:
columns: [
{name: 'id', width: 40},
// {name: 'Code'},
{name: 'Name', width: 140, editable: false},
{name: 'Continent', displayname:'Cont', editable: false},
// {name: 'SurfaceArea', editable: true},
{name: 'Population', width: 140, editable: true},
{name: 'LocalName', displayname:'LN', width: 140, editable: false}
],
// example of validating a changed value:
OnUpdateStart: function(id, colname, value) {
if (colname == 'Population' && (value < 300 || value > 10000)) {
alert('Value of population must be between 300 and 10000');
this.do_update = false;
}
else this.do_update = true;
}
});
</script>
it checks that a change to the Population field is not less than 300 or greater than 10000, but I am able to insert values of 1 and 20000 without any error message being displayed and the database is updated with the new, invalid values.
I tested this on IE7 and Firefox with the same results.
Any advice, please?