Table disappear when enable validating
I like to validate 3 diferent cells entry on one table.
1.- Acept only "S" and "N"
2.- Acept only from 0 to 8
3.- Acept only from 0 to 240
Bud when i enable the cell validatin something happen and i cannot see the table.
My page look like this....
<START>
<html>
<head>
<style>body {font: 12px Tahoma}</style>
<!-- ActiveWidgets stylesheet and scripts -->
<link href="../awg/styles/system/aw.css" rel="stylesheet" type="text/css" ></link>
<script src="../awg/lib/aw.js"></script>
<!-- grid format -->
<style>
#myGrid {height: 90%; width: 100%;}
#myGrid .aw-row-selector {text-align: center}
#myGrid .aw-column-0 {width: 60px;}
#myGrid .aw-column-1 {width: 256px;}
#myGrid .aw-column-2 {width: 16px; text-align: left;}
#myGrid .aw-column-3 {width: 16px; text-align: left;}
#myGrid .aw-column-4 {width: 0px; text-align: left; }
#myGrid .aw-column-5 {width: 64px; text-align: center;}
#myGrid .aw-column-6 {width: 64px; text-align: right;}
#myGrid .aw-column-7 {width: 64px; text-align: right;}
#myGrid .aw-column-8 {width: 96px; text-align: left;}
#myGrid .aw-column-9 {width:120px; text-align: left;}
#myGrid .aw-grid-cell {border-right: 1px solid threedlightshadow;}
#myGrid .aw-grid-row {border-bottom: 1px solid threedlightshadow;}
/* box model fix for strict doctypes, safari */
.aw-strict #myGrid .aw-grid-cell {padding-right: 3px;}
.aw-strict #myGrid .aw-grid-row {padding-bottom: 3px;}
</style>
<!-- grid data -->
<script>
var myData = [
["1","HERNANDEZ/USCANGA,PAULINO","ADMINISTRATIVOS","SUPERVISOR/NOMINAS","5","N","0.00","0.00",""],
["2","PONCE/CARRASCO,IVAN","ADMINISTRATIVOS","AUX. ADMINISTRATIVO","12","N","0.00","0.00",""],
["3","ALEJANDRO/AGUILAR,RUBEN","ADMINISTRATIVOS","AUX. ADMINISTRATIVO","19","N","0.00","0.00",""],
["5","RAMIREZ/,ESTEBAN","ADMINISTRATIVOS","AUX. ADMINISTRATIVO","26","N","0.00","0.00",""],
["6","MENDIOLA/RAMIREZ,JULIO ELEAZAR","ADMINISTRATIVOS","AUX. ADMINISTRATIVO","33","N","0.00","0.00",""],
["11","FRAYRE/ZUĂ‘IGA,OSCAR VALENTIN","ADMINISTRATIVOS","AUX. ADMINISTRATIVO","40","N","0.00","0.00",""],
["12","MENDOZA/DUPONT,ARCEL ROGELIO","ADMINISTRATIVOS","MENSAJERO","47","N","0.00","0.00",""],
["15","GONZALEZ/MORENO,RAQUEL","ADMINISTRATIVOS","AUX. CONTABLE","54","N","0.00","0.00",""],
["16","GONZALEZ/GONZALEZ,MARCO ANTONIO","ADMINISTRATIVOS","AUX. ADMINISTRATIVO","61","N","0.00","0.00",""],
["17","AGUILAR/VARGAS,DARRELL LEE","ADMINISTRATIVOS","AUX. ADMINISTRATIVO","376","N","0.00","0.00",""],
["30","HERNANDEZ/LOPEZ,JUAN","ADMINISTRATIVOS","SUPERVISOR/NOMINAS"] ];
var myColumns = [
"Reloj", "Empleado", "Departamento", "Puesto", "IDMI","FALTA","EXTRAS","RETARDO","NOTAS"
];
</script>
</head>
<body>
<script>
// create ActiveWidgets Grid javascript object
var obj = new AW.Grid.Extended;
obj.setId("myGrid");
// define data formats
var str = new AW.Formats.String;
var num = new AW.Formats.Number;
var de2 = new AW.Formats.Number;
de2.setTextFormat("##.##");
obj.setCellFormat([num, str, str, str, str, num, de2, de2, str]);
// provide cells and headers text
obj.setCellText(myData);
obj.setHeaderText(myColumns);
// set number of rows/columns
obj.setRowCount( 11 );
obj.setColumnCount(9);
// Enable only this columns to edit
obj.setCellEditable(true, 5);
obj.setCellEditable(true, 6);
obj.setCellEditable(true, 7);
obj.setCellEditable(true, 8);
obj.setCellEditable(true, 9);
// Enable the row number show
obj.setSelectorVisible(true);
obj.setSelectorWidth(32);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
// --
obj.setFixedLeft(2); // fix 3 left columns
//obj.setFixedRight(1); // fix 1 right columns
// write grid html to the page
document.write(obj);
document.write("<br>");
var label = new AW.UI.Label;
document.write(label);
// control activated/deactivated (receives/looses focus)
obj.onControlActivated = function(){
label.setControlText("Control activated");
}
obj.onControlDeactivated = function(){
label.setControlText("Control deactivated");
}
// editing starts/ends (F2, Enter, just start typing)
obj.onCellEditStarted = function(text, col, row){
//label.setControlText("Edit started - text: " + text + ", col: " + col + ", row: " + row);
label.setControlText("Editando");
}
obj.onCellEditEnded = function(text, col, row){
label.setControlText("Wait...");
var col1 = myData[row][4]; // Get ID for update
var sack = "http://localhost/PermTemp/dblist/UpdateIncidencias.php?x=" + col1 + "&y=" + col + "&z=" + text + "&d=.";
window.frames['callbackend'].location = sack;
}
// validating (Enter)
//-------------------------------------------------------------------------
// When enable this validators the page not show the TABLE
//-------------------------------------------------------------------------
obj.onCellValidating = function(text, col, row){
if(col == "5") {
var value=text;
if( !(value == "S") && !(value == "N") ) {
label.setControlText("Debe indicar (S) para falta (N) Asistencia");
return true;
}
}
if(col == "7") {
var elnumero=Number(text);
if(!(elnumero >= 0) && !(elnumero =< 10)) {
label.setControlText("Horas extras - solo puede aceptar - desde 0 hasta 10");
return true;
}
}
if(col == "8") {
var elnumero=Number(text);
if (!(elnumero >= 0) && !(elnumero <= 35)) {
label.setControlText("Retardo - solo puede aceptar - desde 0 hasta 35 minutos");
return true;
}
}
}
</script>
<iframe id="callbackend" src="http://localhost/PermTemp/dblist/UpdateIncidencias.php?x=0&y=0&z=0&d=0" frameborder="1" style="width:200px; height: 20px;" scrolling="no"></iframe>
08-09</body>
</html>
<END>
I likte to help me please...
1.- Acept only "S" and "N"
2.- Acept only from 0 to 8
3.- Acept only from 0 to 240
Bud when i enable the cell validatin something happen and i cannot see the table.
My page look like this....
<START>
<html>
<head>
<style>body {font: 12px Tahoma}</style>
<!-- ActiveWidgets stylesheet and scripts -->
<link href="../awg/styles/system/aw.css" rel="stylesheet" type="text/css" ></link>
<script src="../awg/lib/aw.js"></script>
<!-- grid format -->
<style>
#myGrid {height: 90%; width: 100%;}
#myGrid .aw-row-selector {text-align: center}
#myGrid .aw-column-0 {width: 60px;}
#myGrid .aw-column-1 {width: 256px;}
#myGrid .aw-column-2 {width: 16px; text-align: left;}
#myGrid .aw-column-3 {width: 16px; text-align: left;}
#myGrid .aw-column-4 {width: 0px; text-align: left; }
#myGrid .aw-column-5 {width: 64px; text-align: center;}
#myGrid .aw-column-6 {width: 64px; text-align: right;}
#myGrid .aw-column-7 {width: 64px; text-align: right;}
#myGrid .aw-column-8 {width: 96px; text-align: left;}
#myGrid .aw-column-9 {width:120px; text-align: left;}
#myGrid .aw-grid-cell {border-right: 1px solid threedlightshadow;}
#myGrid .aw-grid-row {border-bottom: 1px solid threedlightshadow;}
/* box model fix for strict doctypes, safari */
.aw-strict #myGrid .aw-grid-cell {padding-right: 3px;}
.aw-strict #myGrid .aw-grid-row {padding-bottom: 3px;}
</style>
<!-- grid data -->
<script>
var myData = [
["1","HERNANDEZ/USCANGA,PAULINO","ADMINISTRATIVOS","SUPERVISOR/NOMINAS","5","N","0.00","0.00",""],
["2","PONCE/CARRASCO,IVAN","ADMINISTRATIVOS","AUX. ADMINISTRATIVO","12","N","0.00","0.00",""],
["3","ALEJANDRO/AGUILAR,RUBEN","ADMINISTRATIVOS","AUX. ADMINISTRATIVO","19","N","0.00","0.00",""],
["5","RAMIREZ/,ESTEBAN","ADMINISTRATIVOS","AUX. ADMINISTRATIVO","26","N","0.00","0.00",""],
["6","MENDIOLA/RAMIREZ,JULIO ELEAZAR","ADMINISTRATIVOS","AUX. ADMINISTRATIVO","33","N","0.00","0.00",""],
["11","FRAYRE/ZUĂ‘IGA,OSCAR VALENTIN","ADMINISTRATIVOS","AUX. ADMINISTRATIVO","40","N","0.00","0.00",""],
["12","MENDOZA/DUPONT,ARCEL ROGELIO","ADMINISTRATIVOS","MENSAJERO","47","N","0.00","0.00",""],
["15","GONZALEZ/MORENO,RAQUEL","ADMINISTRATIVOS","AUX. CONTABLE","54","N","0.00","0.00",""],
["16","GONZALEZ/GONZALEZ,MARCO ANTONIO","ADMINISTRATIVOS","AUX. ADMINISTRATIVO","61","N","0.00","0.00",""],
["17","AGUILAR/VARGAS,DARRELL LEE","ADMINISTRATIVOS","AUX. ADMINISTRATIVO","376","N","0.00","0.00",""],
["30","HERNANDEZ/LOPEZ,JUAN","ADMINISTRATIVOS","SUPERVISOR/NOMINAS"] ];
var myColumns = [
"Reloj", "Empleado", "Departamento", "Puesto", "IDMI","FALTA","EXTRAS","RETARDO","NOTAS"
];
</script>
</head>
<body>
<script>
// create ActiveWidgets Grid javascript object
var obj = new AW.Grid.Extended;
obj.setId("myGrid");
// define data formats
var str = new AW.Formats.String;
var num = new AW.Formats.Number;
var de2 = new AW.Formats.Number;
de2.setTextFormat("##.##");
obj.setCellFormat([num, str, str, str, str, num, de2, de2, str]);
// provide cells and headers text
obj.setCellText(myData);
obj.setHeaderText(myColumns);
// set number of rows/columns
obj.setRowCount( 11 );
obj.setColumnCount(9);
// Enable only this columns to edit
obj.setCellEditable(true, 5);
obj.setCellEditable(true, 6);
obj.setCellEditable(true, 7);
obj.setCellEditable(true, 8);
obj.setCellEditable(true, 9);
// Enable the row number show
obj.setSelectorVisible(true);
obj.setSelectorWidth(32);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
// --
obj.setFixedLeft(2); // fix 3 left columns
//obj.setFixedRight(1); // fix 1 right columns
// write grid html to the page
document.write(obj);
document.write("<br>");
var label = new AW.UI.Label;
document.write(label);
// control activated/deactivated (receives/looses focus)
obj.onControlActivated = function(){
label.setControlText("Control activated");
}
obj.onControlDeactivated = function(){
label.setControlText("Control deactivated");
}
// editing starts/ends (F2, Enter, just start typing)
obj.onCellEditStarted = function(text, col, row){
//label.setControlText("Edit started - text: " + text + ", col: " + col + ", row: " + row);
label.setControlText("Editando");
}
obj.onCellEditEnded = function(text, col, row){
label.setControlText("Wait...");
var col1 = myData[row][4]; // Get ID for update
var sack = "http://localhost/PermTemp/dblist/UpdateIncidencias.php?x=" + col1 + "&y=" + col + "&z=" + text + "&d=.";
window.frames['callbackend'].location = sack;
}
// validating (Enter)
//-------------------------------------------------------------------------
// When enable this validators the page not show the TABLE
//-------------------------------------------------------------------------
obj.onCellValidating = function(text, col, row){
if(col == "5") {
var value=text;
if( !(value == "S") && !(value == "N") ) {
label.setControlText("Debe indicar (S) para falta (N) Asistencia");
return true;
}
}
if(col == "7") {
var elnumero=Number(text);
if(!(elnumero >= 0) && !(elnumero =< 10)) {
label.setControlText("Horas extras - solo puede aceptar - desde 0 hasta 10");
return true;
}
}
if(col == "8") {
var elnumero=Number(text);
if (!(elnumero >= 0) && !(elnumero <= 35)) {
label.setControlText("Retardo - solo puede aceptar - desde 0 hasta 35 minutos");
return true;
}
}
}
</script>
<iframe id="callbackend" src="http://localhost/PermTemp/dblist/UpdateIncidencias.php?x=0&y=0&z=0&d=0" frameborder="1" style="width:200px; height: 20px;" scrolling="no"></iframe>
08-09</body>
</html>
<END>
I likte to help me please...
LeirAGS
February 14,