When I want to delete a row from grades grid sometimes works, but mostly does’t work.
see my code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css" media="screen">
//#cont div {
// width:350px;
// height:30px;
//}
//#cont input, select {
// float:left;
// width:500px;
//}
input, select {
width:500px;
}
label{
float: left;
width: 120px;
color:#000000;
font-family:Tahoma;
font-size:12px;
}
.dhxlist_obj_dhx_skyblue label{
float: left;
color:#000000;
font-family:Tahoma;
font-size:11px;
}
.dhxlist_obj_dhx_skyblue .dhxlist_txt_textarea{
border: 1px solid #A4BED4;
padding: 1px 0;
}
html, body
{
width: 100%;
height: 100%;
margin: 0px;
overflow: auto;
background-color: white;
}
</style>
<!-- Common -->
<script type="text/javascript" src="/dhx/dhtmlxGrid/codebase/dhtmlxcommon.js"></script>
<!-- Calender -->
<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxCalendar/codebase/dhtmlxcalendar.css">
<!-- <link rel="STYLESHEET" type="text/css" href="/dhx/dhtmlxCalendar/codebase/skins/dhtmlxcalendar_yahoolike.css"> -->
<link rel="STYLESHEET" type="text/css" href="/dhx/dhtmlxCalendar/codebase/skins/dhtmlxcalendar_dhx_skyblue.css">
<script src="/dhx/dhtmlxCalendar/codebase/dhtmlxcalendar.js"></script>
<!-- Grid -->
<script type="text/javascript" src="/dhx/dhtmlxGrid/codebase/dhtmlxgrid.js"></script>
<script type="text/javascript" src="/dhx/dhtmlxGrid/codebase/dhtmlxgridcell.js"></script>
<script type="text/javascript" src="/dhx/dhtmlxGrid/codebase/ext/dhtmlxgrid_srnd.js"></script>
<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxGrid/codebase/dhtmlxgrid.css">
<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_blue.css">
<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_black.css">
<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxGrid/codebase/skins/dhtmlxgrid_dhx_skyblue.css">
<!-- Layout -->
<script type="text/javascript" src="/dhx/dhtmlxLayout/codebase/dhtmlxlayout.js"></script>
<script type="text/javascript" src="/dhx/dhtmlxLayout/codebase/dhtmlxcontainer.js"></script>
<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxLayout/codebase/dhtmlxlayout.css">
<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxLayout/codebase/skins/dhtmlxlayout_dhx_blue.css">
<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxLayout/codebase/skins/dhtmlxlayout_dhx_black.css">
<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxLayout/codebase/skins/dhtmlxlayout_dhx_skyblue.css">
<!-- Accordion -->
<script type="text/javascript" src="/dhx/dhtmlxAccordion/codebase/dhtmlxcommon.js"></script>
<script type="text/javascript" src="/dhx/dhtmlxAccordion/codebase/dhtmlxaccordion_full.js"></script>
<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxAccordion/codebase/dhtmlxaccordion_full.css">
<!-- Tabbar -->
<script type="text/javascript" src="/dhx/dhtmlxTabbar/codebase/dhtmlxcommon.js"></script>
<script type="text/javascript" src="/dhx/dhtmlxTabbar/codebase/dhtmlxtabbar.js"></script>
<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxTabbar/codebase/dhtmlxtabbar.css">
<!-- Toolbar -->
<script type="text/javascript" src="/dhx/dhtmlxToolbar/codebase/dhtmlxtoolbar.js"></script>
<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxToolbar/codebase/skins/dhtmlxtoolbar_dhx_blue.css">
<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxToolbar/codebase/skins/dhtmlxtoolbar_dhx_black.css">
<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxToolbar/codebase/skins/dhtmlxtoolbar_dhx_skyblue.css">
<!--<script src="/dhx/dhtmlxGrid/codebase/ext/dhtmlxgrid_deprecated.js"></script> -->
<script type="text/javascript" src="/dhx/dhtmlxGrid/codebase/ext/dhtmlxgrid_drag.js"></script>
<script type="text/javascript" src="/dhx/dhtmlxGrid/codebase/ext/dhtmlxgrid_filter.js"></script>
<script type="text/javascript" src="/dhx/dhtmlxGrid/codebase/ext/dhtmlxgrid_keymap_access.js"></script>
<script type="text/javascript" src="/dhx/dhtmlxGrid/codebase/ext/dhtmlxgrid_keymap_excel.js"></script>
<script type="text/javascript" src="/dhx/dhtmlxGrid/codebase/ext/dhtmlxgrid_keymap_extra.js"></script>
<script type="text/javascript" src="/dhx/dhtmlxGrid/codebase/ext/dhtmlxgrid_nxml.js"></script>
<script type="text/javascript" src="/dhx/dhtmlxGrid/codebase/ext/dhtmlxgrid_selection.js"></script>
<script type="text/javascript" src="/dhx/dhtmlxGrid/codebase/ext/dhtmlxgrid_start.js"></script>
<script type="text/javascript" src="/dhx/dhtmlxGrid/codebase/ext/dhtmlxgrid_validation.js"></script>
<!-- <script type="text/javascript" src="/dhx/dhtmlxGrid/codebase/excells/dhtmlxgrid_excell_calendar.js"></script> -->
<script type="text/javascript" src="/dhx/dhtmlxGrid/codebase/excells/dhtmlxgrid_excell_dhxcalendar.js"></script>
<!-- Form -->
<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxForm/codebase/skins/dhtmlxform_dhx_skyblue.css">
<!-- <script type="text/javascript" src="/dhx/dhtmlxForm/codebase/dhtmlxcommon.js"></script>-->
<script type="text/javascript" src="/dhx/dhtmlxForm/codebase/dhtmlxform.js"></script>
<script type="text/javascript" src="/dhx/dhtmlxForm/codebase/ext/dhtmlxform_item_editor.js"></script>
<!--
<script type="text/javascript" src="/dhx/dhtmlxForm/codebase/ext/dhtmlxform_item_calender.js"></script>
<script type="text/javascript" src="/dhx/dhtmlxForm/codebase/ext/dhtmlxform_item_colorpicker.js"></script>
<script type="text/javascript" src="/dhx/dhtmlxForm/codebase/ext/dhtmlxform_item_combo.js"></script>
-->
<!-- Editor -->
<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxEditor/codebase/skins/dhtmlxeditor_dhx_skyblue.css">
<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxToolbar/codebase/skins/dhtmlxtoolbar_dhx_skyblue.css">
<script type="text/javascript" src="/dhx/dhtmlxEditor/codebase/dhtmlxeditor.js"></script>
<script type="text/javascript" src="/dhx/dhtmlxEditor/codebase/ext/dhtmlxeditor_ext.js"></script>
<script type="text/javascript" src="/dhx/dhtmlxToolbar/codebase/dhtmlxtoolbar.js"></script>
<!--
<script type="text/javascript" src="/dhx/dhtmlxEditor/codebase/ext/dhtmlxform_ext.js"></script>
<link rel="stylesheet" type="text/css" href="/dhx/dhtmlxEditor/codebase/dhtmlxeditor.css">
-->
<!-- Dataprocessor -->
<script type="text/javascript" src="/dhx/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js"></script>
<!-- <script type="text/javascript" src="/dhx/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor_debug.js"></script> -->
<!-- Connector -->
<script type="text/javascript" src="/dhx/dhtmlxConnector/codebase/connector.js"></script>
<script type="text/javascript" >
// global variables
var dhxGrid = null, dhxLayout = null, dhxToolbar = null, dhxTabbar = null;
var gridContact = null, contactToolbar = null, dpContact=null;
var gridAccommodation = null, accommodationToolbar = null, dpAccommodation = null;
var gridGrades = null, gradesToolbar = null, dpGrades=null;
var gridLocations = null, locationsToolbar = null, dpLocations=null;
var dpMarker = null;
var formMarker = null, dpFrmMarker= null;
var g_marker_id, idMarkerEvent, idTabEvent;
function doOnload() {
// -- Layout Menu
dhxLayout = new dhtmlXLayoutObject(document.body, "3L", "dhx_skyblue");
// -- Layout Grid
dhxLayout.cells("a").setText("Menu");
dhxLayout.cells("a").setWidth(200);
var dhxAccord = dhxLayout.cells("a").attachAccordion();
dhxAccord.addItem("a1", "markers");
dhxAccord.addItem("a2", "inspections");
dhxAccord.openItem("a1");
dhxLayout.cells("b").setText("Markers");
dhxLayout.cells("b").setHeight(240);
dhxLayout.cells("c").hideHeader();
markerGrid();
}
function markerGrid() {
// -- Layout Grid attachToolbar
/*
if (dhxToolbar == null) {
dhxToolbar = dhxLayout.cells("a").attachToolbar();
dhxToolbar.addButton("btn_add", 1, "Add");
dhxToolbar.addSeparator("sep", 2);
dhxToolbar.addButton("btn_del", 3, "Delete");
dhxToolbar.addSeparator("sep", 4);
dhxToolbar.addButton("btn_edit", 5, "Edit");
dhxToolbar.base.onclick=function(e){e=e||event;e.cancelBubble=true;};
dhxToolbar.attachEvent("onClick", function(id) {
if (id == "btn_add") {
var idd=dhxGrid.uid();
dhxGrid.addRow(idd,'',0);
dhxGrid.showRow(idd);
}
if (id == "btn_del") {
dhxGrid.deleteSelectedRows();
}
if (id == "btn_edit") {
//dhxGrid.editCell();
}
});
}
*/
// -- Layout Grid attachGrid
if (dhxGrid == null) {
dhxGrid = dhxLayout.cells("b").attachGrid();
dhxGrid.setImagePath("/dhx/dhtmlxGrid/codebase/imgs/");
dhxGrid.setHeader("Name, Address, City, Province, Zip code, Phone");
dhxGrid.setInitWidths("300,*");
dhxGrid.enableAutoWidth(true);
dhxGrid.setColTypes("ed,ed,ed,coro,ed,ed");
dhxGrid.attachHeader("#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_select_filter,#connector_text_filter,#connector_text_filter");
dhxGrid.setColSorting("str,str,str,str,str,str");
//dhxGrid.enableSmartRendering(true);
idMarkerEvent = dhxGrid.attachEvent("onRowSelect", markerSelected);
dhxGrid.init();
}
dhxGrid.clearAll();
dhxGrid.loadXML("connector_marker.php");
dpMarker = new dataProcessor("connector_marker.php");
dpMarker.init(dhxGrid);
}
function accommodation() {
if (accommodationToolbar == null) {
accommodationToolbar = dhxTabbar.cells("a1").attachToolbar();
accommodationToolbar.setSkin("dhx_skyblue");
accommodationToolbar.addButton("btn_add", 1, "Add");
accommodationToolbar.addSeparator("sep", 2);
accommodationToolbar.addButton("btn_del", 3, "Delete");
accommodationToolbar.addSeparator("sep", 4);
accommodationToolbar.addButton("btn_edit", 5, "Edit");
accommodationToolbar.addSeparator("sep", 6);
accommodationToolbar.addButton("btn_save", 7, "Save changes");
accommodationToolbar.base.onclick=function(e){e=e||event;e.cancelBubble=true;};
accommodationToolbar.attachEvent("onClick", function(id) {
if (id == "btn_add") {
var idd=gridAccommodation.uid();
gridAccommodation.addRow(idd,'',0);
gridAccommodation.showRow(idd);
}
if (id == "btn_del") {
gridAccommodation.deleteSelectedRows();
dpAccommodation.sendData();
}
if (id == "btn_edit") {
gridAccommodation.editCell();
}
if (id == "btn_save") {
if (dpAccommodation != null) {
dpAccommodation.sendData();
}
}
return true;
});
}
if (gridAccommodation == null) {
gridAccommodation = dhxTabbar.cells("a1").attachGrid();
gridAccommodation.setImagePath("/dhx/dhtmlxGrid/codebase/imgs/");
gridAccommodation.setSkin("dhx_skyblue");
gridAccommodation.setHeader("Accommodation Type,# Rooms,Date,Description");
gridAccommodation.setInitWidths("150,60,80,*");
gridAccommodation.enableAutoWidth(true);
//gridAccommodation.enableSmartRendering(true);
gridAccommodation.setColTypes("coro,ed,dhxCalendar,txt");
gridAccommodation.attachHeader("#connector_select_filter, , ,#connector_text_filter");
gridAccommodation.setColSorting("str,int,date,str");
gridAccommodation.init();
}
gridAccommodation.clearAll();
gridAccommodation.loadXML("connector_accommodation.php?marker_id="+g_marker_id);
dpAccommodation = new dataProcessor("connector_accommodation.php?marker_id="+g_marker_id);
dpAccommodation.setUpdateMode("off");
function not_empty (value, id, ind){
if (value == "")
return "Value at (" + id + ", " + ind + ") can't be empty";
return true;
}
function greater_0(value, id, ind) {
if (parseFloat(value) <= 0)
return "Value at (" + id + ", " + ind + ") must be greater than 0";
return true;
}
dpAccommodation.setVerificator( 0, not_empty);
dpAccommodation.setVerificator( 2, not_empty);
dpAccommodation.setVerificator( 1, greater_0);
dpAccommodation.attachEvent("onValidationError", function(id, errors) {
alert(errors.join("\n"));
return true;
//confirm block
});
dpAccommodation.init(gridAccommodation);
//dpAccommodation.enablePartialDataSend(true);
}
function contact() {
if (contactToolbar == null) {
contactToolbar = dhxTabbar.cells("a2").attachToolbar();
contactToolbar.setSkin("dhx_skyblue");
contactToolbar.addButton("btn_add", 1, "Add");
contactToolbar.addSeparator("sep", 2);
contactToolbar.addButton("btn_del", 3, "Delete");
contactToolbar.addSeparator("sep", 4);
contactToolbar.addButton("btn_edit", 5, "Edit");
contactToolbar.addSeparator("sep", 6);
contactToolbar.addButton("btn_save", 7, "Save changes");
contactToolbar.base.onclick=function(e){e=e||event;e.cancelBubble=true;};
contactToolbar.attachEvent("onClick", function(id) {
if (id == "btn_add") {
var idd=gridContact.uid();
gridContact.addRow(idd,'title,firstname,lastname,,phone',0);
gridContact.showRow(idd);
}
if (id == "btn_del") {
gridContact.deleteSelectedRows();
dpContact.sendData();
}
if (id == "btn_edit") {
gridContact.editCell();
}
if (id == "btn_save") {
if (dpContact != null) {
dpContact.sendData();
}
}
return true;
});
}
if (gridContact == null) {
gridContact = dhxTabbar.cells("a2").attachGrid();
gridContact.setImagePath("/dhx/dhtmlxGrid/codebase/imgs/");
gridContact.setSkin("dhx_skyblue");
gridContact.setHeader("Title,First Name,Last Name,Suffix,Phone,Fax,Pager,Mobile,E-mail,Note(s),Contact Type");
gridContact.setInitWidths("75,120,120,75,90,90,90,90,*,100,150");
gridContact.enableAutoWidth(true);
//gridContact.enableSmartRendering(true);
gridContact.setColTypes("ed,ed,ed,ed,ed,ed,ed,ed,ed,ed,coro");
gridContact.attachHeader(" ,#connector_text_filter,#connector_text_filter, ,#connector_text_filter, , ,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_select_filter");
gridContact.setColSorting("str,str,str,str,str,str,str,str,str,str,str");
gridContact.init();
}
gridContact.clearAll();
gridContact.loadXML("connector_contact.php?marker_id="+g_marker_id);
dpContact = new dataProcessor("connector_contact.php?marker_id="+g_marker_id);
dpContact.setUpdateMode("off");
function not_empty (value, id, ind){
if (value == "")
return "Value at (" + id + ", " + ind + ") can't be empty";
return true;
}
dpContact.setVerificator( 1, not_empty);
dpContact.setVerificator( 2, not_empty);
dpContact.setVerificator( 4, not_empty);
dpContact.setVerificator(10, not_empty);
dpContact.attachEvent("onValidationError", function(id, errors) {
alert(errors.join("\n"));
return true;
//confirm block
});
dpContact.init(gridContact);
//dpContact.enablePartialDataSend(true);
}
function grades() {
if (gradesToolbar == null) {
gradesToolbar = dhxTabbar.cells("a3").attachToolbar();
gradesToolbar.setSkin("dhx_skyblue");
gradesToolbar.addButton("btn_add", 1, "Add");
gradesToolbar.addSeparator("sep", 2);
gradesToolbar.addButton("btn_del", 3, "Delete");
gradesToolbar.addSeparator("sep", 4);
gradesToolbar.addButton("btn_edit", 5, "Edit");
gradesToolbar.addSeparator("sep", 6);
gradesToolbar.addButton("btn_save", 7, "Save changes");
gradesToolbar.base.onclick=function(e){e=e||event;e.cancelBubble=true;};
gradesToolbar.attachEvent("onClick", function(id) {
if (id == "btn_add") {
var idd=gridGrades.uid();
gridGrades.addRow(idd,'50',0);
gridGrades.showRow(idd);
}
if (id == "btn_del") {
if (confirm("Are you sure?"))
{
window.setTimeout(function(){
gridGrades.deleteSelectedRows();
},5);
dpGrades.sendData();
gridGrades.clearAll();
gridGrades.loadXML("connector_grades.php?marker_id="+g_marker_id);
}
}
if (id == "btn_edit") {
gridGrades.editCell();
}
if (id == "btn_save") {
if (dpGrades != null) {
dpGrades.sendData();
}
}
return true;
});
}
if (gridGrades == null) {
gridGrades = dhxTabbar.cells("a3").attachGrid();
gridGrades.setImagePath("/dhx/dhtmlxGrid/codebase/imgs/");
gridGrades.setSkin("dhx_skyblue");
gridGrades.setHeader("Score,to Grade");
gridGrades.setInitWidths("75,*");
gridGrades.enableAutoWidth(true);
//gridGrades.enableSmartRendering(true);
gridGrades.setColTypes("ed,coro");
gridGrades.attachHeader(" ,#connector_select_filter");
gridGrades.setColSorting("str,str");
gridGrades.init();
}
gridGrades.clearAll();
gridGrades.loadXML("connector_grades.php?marker_id="+g_marker_id);
dpGrades = new dataProcessor("connector_grades.php?marker_id="+g_marker_id);
dpGrades.setUpdateMode("off");
dpGrades.setVerificator(0, not_empty);
dpGrades.setVerificator(1, no_choice);
dpGrades.setVerificator(0, valid_percentage);
dpGrades.attachEvent("onValidatationError", function(id, errors) {
alert(errors.join("\n"));
return true;
});
dpGrades.init(gridGrades);
}
function no_choice (value, id, ind){
if ( value == "" )
return "No selection made, please choose object to grade";
return true;
}
function not_empty (value, id, ind){
if ( value == "" )
return "Value "+value+" at (" + id + ", " + ind + ") can't be empty";
return true;
}
function valid_percentage (value, id, ind){
if (parseFloat(value)<0 || parseFloat(value)>100)
return "Value "+value+" at (" + id + ", " + ind + ") not between 0 and 100";
return true;
}
function locations() {
/*if (locationsToolbar == null) {
locationsToolbar = dhxTabbar.cells("a4").attachToolbar();
locationsToolbar.setSkin("dhx_skyblue");
locationsToolbar.addButton("btn_add", 1, "Add");
locationsToolbar.addSeparator("sep", 2);
locationsToolbar.addButton("btn_del", 3, "Delete");
locationsToolbar.addSeparator("sep", 4);
locationsToolbar.addButton("btn_edit", 5, "Edit");
locationsToolbar.addSeparator("sep", 6);
locationsToolbar.addButton("btn_save", 7, "Save changes");
locationsToolbar.base.onclick=function(e){e=e||event;e.cancelBubble=true;};
locationsToolbar.attachEvent("onClick", function(id) {
if (id == "btn_add") {
var idd=gridLocations.uid();
gridLocations.addRow(idd,'50,',0);
gridLocations.showRow(idd);
}
if (id == "btn_del") {
gridLocations.deleteSelectedRows();
}
if (id == "btn_edit") {
gridLocations.editCell();
}
if (id == "btn_save") {
if (dpLocations != null) {
dpLocations.sendData();
}
}
return true;
});
}
*/
if (gridLocations == null) {
gridLocations = dhxTabbar.cells("a4").attachGrid();
gridLocations.setImagePath("/dhx/dhtmlxGrid/codebase/imgs/");
gridLocations.setSkin("dhx_skyblue");
gridLocations.setHeader(" , Location Name");
gridLocations.setInitWidths("75,300");
gridLocations.enableAutoWidth(true);
//gridLocations.enableSmartRendering(true);
gridLocations.setColTypes("ch,ed");
gridLocations.setColSorting("str,str");
gridLocations.init();
}
gridLocations.clearAll();
gridLocations.loadXML("connector_location.php?marker_id="+g_marker_id);
dpLocations = new dataProcessor("connector_location.php?marker_id="+g_marker_id);
dpLocations.init(gridLocations);
}
function frmMarker() {
if (formMarker == null) {
window.dhx_globalImgPath = "/dhx/dhtmlxCombo/codebase/imgs/";
dhtmlx.skin = "dhx_skyblue";
dhtmlx.image_path = "/dhx/dhtmlxEditor/codebase/imgs/";
var formData = [
{type: "newcolumn"},
{type: "fieldset", label: "Location", list:[
{type: "settings", position: "label-left", labelWidth: 80 ,inputWidth: 335},
{type: "input", name: "name", label:"Markername", validate: "NotEmpty", value: ""},
{type: "input", name: "address", label:"Address", validate: "NotEmpty", value: ""},
{type: "input", name: "city", label:"City", validate: "NotEmpty", value: ""},
{type: "input", name: "zipcode", label:"Zip-code", validate: "NotEmpty", value: ""},
{type: "select", name: "provinceID", label:"Province", connector: "options_provinces.php", bind:"provinceID"},
]},
{type: "fieldset", label: "Star Rating", list:[
{type: "block", inputWidth: "auto", inputWidth: 435, list:[
{type: "newcolumn"},{type: "radio", name: "stars", position: "label-right", value: "1", label: "1"},
{type: "newcolumn"},{type: "radio", name: "stars", position: "label-right", value: "2", label: "2"},
{type: "newcolumn"},{type: "radio", name: "stars", position: "label-right", value: "3", label: "3"},
{type: "newcolumn"},{type: "radio", name: "stars", position: "label-right", value: "4", label: "4"},
{type: "newcolumn"},{type: "radio", name: "stars", position: "label-right", value: "5", label: "5"},
{type: "newcolumn"},{type: "radio", name: "stars", position: "label-right", value: "6", label: "6"},
{type: "newcolumn"},{type: "radio", name: "stars", position: "label-right", value: "7", label: "7"},
]},
]},
{type: "fieldset", label: "Property", list:[
{type: "settings", position: "label-left", labelWidth: "auto" ,inputWidth: 300},
{type: "label", label:"Marker location (Lat/Lon)"},
{type: "input", id: "lattitude", name: "lattitude", label:"LAT", validate: "^-?([1-8]?[1-9]|[1-9]0)[.]{1}[0-9]{1}", value: ""}, //[-]?[0-9]*[.]?[0-9]+
{type: "input", id: "longitude", name: "longitude", label:"LON", validate: "^-?([1]?[1-7][1-9]|[1]?[1-8][0]|[1-9]?[0-9])[.]{1}[0-9]{1}", value: ""}, //[-]?[0-9]*[.]?[0-9]+
{type: "label", label:"Marker near the following route"},
{type: "select", name: "route_id", label:"Route", connector: "options_routes.php", bind:"route_id"},
{type: "label", label:"Facilities"},
{type: "block", inputWidth: 300, labelWidth: 75, list:[
{type: "checkbox", name: "parking_on_site", bind: "parking_on_site", position: "label-right", value: "1", label: "Parking on site"},
{type: "checkbox", name: "child_friendly", bind: "child_friendly", position: "label-right", value: "1", label: "Child Friendly"},
{type: "checkbox", name: "invalid_friendly", bind: "invalid_friendly", position: "label-right", value: "1", label: "Invalide Friendly"}
]},
]},
{type: "block", inputWidth: "1", inputWidth: 500, list:[
{type: "button", name: "btn2", value: "Save Changes", command: "customCommand"},
{type: "button", name: "btn1", value: "Reset form data", command: "customCommand"},
{type: "newcolumn"},
{type: "button", name: "btn3", value: "Validate", command: "customCommand"},
{type: "button", name: "btn4", value: "Clear validation errors", command: "customCommand"},
{type: "newcolumn"},
{type: "label", name: "lblMsgValidate", id: "lblMsgValidate", style: "color: green", label:""},
]},
{type: "newcolumn"},
{type: "fieldset", label: "Contact", list:[
{type: "settings", position: "label-left", labelWidth: 80 ,inputWidth: 325},
{type: "input", name: "phone", label:"Phone", validate: "NotEmpty", value: "" },
{type: "input", name: "fax", label:"Fax", value: ""},
{type: "input", name: "website", label:"Website", value: ""},
{type: "input", name: "email", label:"E-mail", validate: "NotEmpty,ValidEmail", value: ""},
]},
{type: "fieldset", label: "Times to check in / check out", list:[
{type: "settings", position: "label-left", labelWidth: 80 ,inputWidth: 325},
{type: "input", name: "checkin", label:"Check in from", validate: "^([0-1]?[0-9]|[2][0-3]):([0-5][0-9])$", value: ""},
{type: "input", name: "checkout", label:"Check out from", validate: "^([0-1]?[0-9]|[2][0-3]):([0-5][0-9])$", value: ""},
]},
{type: "fieldset", label: "Marker Description", list:[
{type: "editor", name: "description", label: "", bind: "description",labelWidth: 1, inputWidth: 415, inputHeight: 240, value: ""},
]},
];
formMarker = dhxTabbar.cells("a5").attachForm(formData);
formMarker.setSkin("dhx_skyblue");
formMarker.attachEvent("onButtonClick", function(name) {
if(name=="btn1") {
// Reset data to original state
formMarker.load("connector_form_marker.php?id="+g_marker_id);
} else if(name=="btn2") {
// If valid save data and reload grid markers
if (formMarker.validate()){
formMarker.save();
markerGrid();
formMarker.setItemLabel("lblMsgValidate", "Saved Changes");
} else {
// form is not valid or filled in correctly
formMarker.setItemLabel("lblMsgValidate", "Form is NOT Valid");
}
} else if (name=="btn3") {
// validate form
if (formMarker.validate()) {
// alert ("Form is valid");
formMarker.setItemLabel("lblMsgValidate", "Form is Valid");
} else {
// alert ("Some fields are not Valid");
formMarker.setItemLabel("lblMsgValidate", "Form is NOT Valid");
}
} else if(name=="btn4") {
// reset validate errors
formMarker.resetValidateCss();
formMarker.setItemLabel("lblMsgValidate", "");
}
});
}
formMarker.load("connector_form_marker.php?id="+g_marker_id);
dpFrmMarker = new dataProcessor("connector_form_marker.php?id="+g_marker_id);
//dpFrmMarker.setTransactionMode("POST", true);
dpFrmMarker.init(formMarker);
}
function markerSelected(marker_id) {
g_marker_id = marker_id;
if (dhxTabbar == null) {
dhxTabbar = dhxLayout.cells("c").attachTabbar();
dhxTabbar.setImagePath("/dhx/dhtmlxTabbar/codebase/imgs/");
dhxTabbar.setSkin("modern");
dhxTabbar.addTab("a1", "Accommodations", "130px");
dhxTabbar.addTab("a2", "Contacts", "100px");
dhxTabbar.addTab("a3", "Grades", "100px");
dhxTabbar.addTab("a4", "Located at", "100px");
dhxTabbar.addTab("a5", "Marker Details", "100px");
idTabEvent = dhxTabbar.attachEvent("onSelect", "tabSelected");
dhxTabbar.setTabActive("a5");
}
// Reset validation for the form marker
if (formMarker != null) {
formMarker.resetValidateCss();
formMarker.setItemLabel("lblMsgValidate", "");
}
if (dhxTabbar.getActiveTab() != null) {
getActiveTab(dhxTabbar.getActiveTab());
}
}
function tabSelected(id, last_id) {
// fill grid
getActiveTab(id);
return true;
}
function getActiveTab(id) {
// First Sending data changes
if (dpAccommodation != null)
dpAccommodation.sendData();
if (dpContact != null)
dpContact.sendData();
if (dpGrades != null)
dpGrades.sendData();
switch (id) {
case "a1" : accommodation(); break;
case "a2" : contact(); break;
case "a3" : grades(); break;
case "a4" : locations(); break;
case "a5" : frmMarker(); break;
}
}
</script>
</head>
<body onload="doOnload();">
</body>
</html>