Categories | Question details Back To List | ||
dhxCalendar and dhxCalendarA Issue Hi, i have a problem with dhxCalendar and dhxCalendarA (dhtmlx 2.5 rel 2). Using the previuos version (dhtmlxSuite_2009Rel1_pro_90226) everything was ok but now if i try to check via javascript cell value of dhxCalendarA cell it returns "" (empty string) everytime, so i can't set a verificator for this cell. it happens also on the server side (date is everytime "" empty string) so i can't save correctly data on DB; I am using pro version. I post my code: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@page import="com.alisea.web.app.servlet.Constants"%> <html> <link rel="STYLESHEET" type="text/css" href="css/alisea.css"> <script language="javascript" src="js/aliseaweb.js"></script> <script language="javascript" src="js/ajax.js"></script> <LINK REL="SHORTCUT ICON" href="imgs/favicon.ico"> <link rel="icon" href="imgs/alisea.jpg" type="image/jpg" /> <link rel="STYLESHEET" type="text/css" href="css/alisea.css"> <!--css/alisea.css">--> <link rel="STYLESHEET" type="text/css" href="css/dhtmlxgrid_pgn_bricks.css"> <link rel="stylesheet" type="text/css" href="css/dhtmlxgrid_dhx_skyblue.css"> <link rel="STYLESHEET" type="text/css" href="css/dhtmlxgrid.css"> <link rel="STYLESHEET" type="text/css" href="css/dhtmlxgrid_skins.css"> <link rel="STYLESHEET" type="text/css" href="css/dhtmlxcalendar.css"> <link rel="STYLESHEET" type="text/css" href="css/dhtmlxcombo.css"> <script>_css_prefix="css/"; _js_prefix="js/"; </script> <script src="js/grid/dhtmlxcommon.js"></script> <script src="js/grid/dhtmlxgrid.js"></script> <script src="js/grid/dhtmlxgridcell.js"></script> <script src="js/grid/dhtmlxcalendar.js"></script> <script src="js/grid/dhtmlxgrid_excell_dhxcalendar.js"></script> <script language="javascript" src="js/grid/dhtmlxgrid_pgn.js"></script> <script language="javascript" src="js/grid/dhtmlxgrid_filter.js"></script> <script language="javascript" src="js/grid/dhtmlxgrid_excell_acheck.js"></script> <script language="javascript" src="js/grid/dhtmlxgrid_excell_clist.js"></script> <script language="javascript" src="js/combo/dhtmlxcommon.js"></script> <script language="javascript" src="js/grid/dhtmlxgrid_excell_combo.js"></script> <script language="javascript" src="js/combo/dhtmlxcombo.js"></script> <script language="javascript" src="js/combo/dhtmlxcombo_extra.js"></script> <script language="javascript" src="js/grid/dhtmlxgrid_hmenu.js"></script> <script language="javascript" src="js/grid/dhtmlxdataprocessor.js"></script> <script type="text/javascript"> var focus_already_set = false; var Lista_licenze_grid; function validateEmptyCell(value, id_row, index) { if(value == '' || typeof value == 'undefined' || value == 'null'){ if(!focus_already_set) { visualizza_info("Uno o più campi colorati sono vuoti e vanno compilati.\n", 'red'); Lista_licenze_grid.selectCell(0, index, false, false, true, true); //setTimeout("seleziona_cella(0, "+index+",'gridbox_licenze')",1); focus_already_set = true; } return (false); } else { if(index == 2 || index == 3 || index == 4) { // controllo che sia un numero if(isNaN(value)) { if(!focus_already_set) { visualizza_info("Uno o più campi colorati sono vuoti e vanno compilati.\n", 'red'); Lista_licenze_grid.selectCell(0, index, false, false, true, true); //setTimeout("seleziona_cella(0, "+index+",'gridbox_licenze')",1); focus_already_set = true; } return (false); } else { focus_already_set = false; return(true); } } else { focus_already_set = false; return(true); } } } function getAjaxGrid (id) { if ( id=='gridbox_licenze') { return Lista_licenze_grid; } } function InserisciNuovaLicenza(id_grid) { Lista_licenze_grid.addRow((new Date()).valueOf(),[,,,,],0); } function validateEmpty(fld) { var error = ""; var prova = fld.type; if(fld.type=='text' || fld.type =='hidden' || fld.type =='select-one' || fld.type == 'password'){ if (fld.value.length == 0) { fld.style.background = 'Red'; error = "Uno o più campi colorati sono vuoti e vanno compilati.\n" } else { fld.style.background = 'White'; } return error; } else { return ""; } } function AbilitaTastoDelete () { document.getElementById("cancella_licenza").disabled=false; } function cancella(id_grid){ getAjaxGrid(id_grid).deleteSelectedRows(); } </script> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Gestione Licenze</title> </head> <body> <form name="form1"> <table width="100%"> <tr> <td> <table width="100%"> <tr> <td align="center"><div id="BOX_MESSAGGI" style="visibility: hidden" align="center" class="" ><input border="0" readonly="readonly" type="text" name="_MESSAGGI" id="_MESSAGGI" value="" size="200"></div></td> </tr> </table> </td> </tr> </table> <fieldset> <legend class="titolo">Licenze</legend> <table border="0" width="100%"> <tr> <td colspan="5"> <table width="100%" align="center"> <tr> <td align="center"> <input type="button" id="nuovo_licenza" value="Inserisci Nuova Licenza" onClick="(arguments[0]||window.event).cancelBubble=true;InserisciNuovaLicenza('gridbox_licenze');"></input> </td> <td align="center"> <input disabled="disabled" type="button" id="cancella_licenza" value="Cancella Licenza" onClick="(arguments[0]||window.event).cancelBubble=true;cancella('gridbox_licenze');"></input> </td> </tr> <tr> <td valign="top" align="center" colspan="2"> <div id="gridbox_licenze" width="590px" height="300px" align="left" style="background-color:;"></div> </td> </tr> </table> </table> </fieldset> <input type="hidden" name="_XML_LISTA_LICENZE" id="_XML_LISTA_LICENZE" value="<%=request.getAttribute(Constants._XML_LISTA_LICENZE)%>"> <input type="hidden" name="index" value="<%=request.getAttribute("index")%>"> <input type="hidden" name="fun" value=""> <input type="hidden" name="selected" value=""> <input type="hidden" name="nuova_riga" id="nuova_riga" value="false"> </form> </body> </html> <script> var xml_lista_licenze = document.getElementById("_XML_LISTA_LICENZE").value; Lista_licenze_grid = new dhtmlXGridObject('gridbox_licenze'); Lista_licenze_grid.attachEvent("onRowSelect",AbilitaTastoDelete); Lista_licenze_grid.setImagePath("imgs/"); Lista_licenze_grid.setHeader("Codice Licenza, Data Scadenza, Utenti Permessi, Unità locali con registro permesse ,Codici cer permessi"); Lista_licenze_grid.setInitWidths("110,120,120,120,120"); Lista_licenze_grid.setColAlign("center,center,center,center,center") Lista_licenze_grid.setColTypes("ed,dhxCalendarA,ed,ed,ed"); Lista_licenze_grid.setColSorting("str,str,str,str,str") Lista_licenze_grid.setSkin("dhx_skyblue"); Lista_licenze_grid.setDateFormat("%d-%m-%Y"); Lista_licenze_grid.init(); if ( xml_lista_licenze!='' && xml_lista_licenze!='null' ) { Lista_licenze_grid.loadXMLString(xml_lista_licenze); } DataProcessorLic = new dataProcessor("Licenze.do?fun=updLic"); DataProcessorLic.setUpdateMode("cell"); DataProcessorLic.setVerificator(0,validateEmptyCell);// Nome Licenza DataProcessorLic.setVerificator(1,validateEmptyCell);// Data scandenza licenza DataProcessorLic.setVerificator(2,validateEmptyCell);// utenti permessi DataProcessorLic.setVerificator(3,validateEmptyCell);// Unita locali permesse DataProcessorLic.setVerificator(4,validateEmptyCell);// codici cer permessi DataProcessorLic.init(Lista_licenze_grid); </script> I am quite sure that is not my fault beacause with old version everything work. Thank you for you help. Jacopo. Answer posted by dhxSupport on Sep 09, 2009 06:32 Can you please provide sample of xml string which you are using. We tested "dhxCalendar" and "dhxCalendarA" cells with getValue() method and with setVerificator() dataProcessor's method and everything work fine. Answer posted by Jacopo on Sep 09, 2009 07:03 <?xml version='1.0' encoding='UTF-8'?><rows><row id='1'><cell>prova</cell><cell>08-09-2009</cell><cell>1</cell><cell>1</cell><cell>1000</cell></row></rows> Thank you for your reply :) Answer posted by dhxSupport on Sep 09, 2009 07:40 "dhxCalendarA" cell's value correctly passed to the validateEmptyCell() function. Please provide us complete example and steps to reproduce this issue. Answer posted by jacopo on Sep 10, 2009 00:17 Hi, i dont know how to provide you a complete example because i am using tomcat with a web application and this issue is visible only on debug mode. any tips? thank you. Jacopo. Answer posted by jacopo on Sep 10, 2009 00:44 i am sorry for double post but i have noticed that this issue happens only for new row and not when i edit an old one. Jacopo Answer posted by mfannon on Oct 06, 2009 08:41 Hi, I am experiencing what appears to be the same problem. In my case, I am trying to retrieve values POSTed by the grid and am finding calendar values as empty strings. Here are the symptoms: 1. If the date field has a non-empty initial value, I can update it properly with the calendar and everything works as expected. 2. If the date field is empty, the calendar pop-up works and puts a formatted date into the cell. However, the value returned from the post is the empty string. 3. Dates can be manually entered with good success (that is, by typing it into the field rather than using the calendar pop-up). Hopefully this description will help you track it down. I will continue my testing and will share an sample when I have one that clearly isolates the problem. -- Mike Answer posted by bgil on Dec 18, 2009 15:07 Has this problem been solved? I am also having this issue. Answer posted by Oleg on Jan 18, 2010 18:06 I am having the same problem as well. Thanks guys for the leads. I start to put dummy data for the newly created rows as a work around: myGrid.setCellExcellType(rowId, colIndex, 'dhxCalendar'); if(myGrid.cellByIndex(rowId, colIndex.getValue() == '') myGrid.cellByIndex(rowId, colIndex).setValue(getFormattedDate(new Date())); |