I have a form and inside it I have some calendar fields, like this:
…
{ type:“calendar” , name:“fechaCaducidad”, label:“Caducidad”, dateFormat:"%d-%m-%Y %H:%i", labelWidth:“100”, labelHeight:“21”, inputWidth:“110”, inputHeight:“21”, enableTime:true, options:{}, labelLeft:“515”, labelTop:“165”, inputLeft:“515”, inputTop:“186”, position:“absolute” },
…
I want to save into MySQL but return the field like this:
fechaCaducidad=‘Sun Jan 01 2012 14:57:00 GMT+0100’
But with this format don’t update the table.
What I must do for that field return the calendar info like this: ‘2012-01-03 07:58:06’ ?
Hello ) That’s my first, but definetly NOT the last post here )
I faced same problem in v3, and as urgency of problem didn’t left me any other choices, I’ve developed a fix for it…
It’s quite dirty, but - it works…
function correctcalendarvalue(pform,pid)
{
if (pform.itemPull[pform.idPrefix+pid]._type == "calendar" )
{
pform.itemPull[pform.idPrefix+pid]._value = pform.getInput(pid).value;
}
}
someform.attachEvent("onChange", function (id, value)
{
correctcalendarvalue(someform,id)
});
PS: Maybe this one eventually will help devs somehow, to trace this error ) It is allmost written in this fix )
PPS: I am working with DX for just a few weeks (my company btw has pro siute bought from them), but during that time I’ve allready had a lots of chances to learn how marvelous this whole project is… And ofcource those guys that are doing it
Anyway, just wanted to say that guys are doing great job Keep up the same ways guys, best regards )
Hi Zinger,
Your Workaround is great, thanks for sharing!
But it only works if the calendar is not inside a fieldset or block… For now i placed all my calendars directly on the form - but it would be great if somebody from the DHTMLX-team would write a fix for this problem!?!
Ps… Just found out that this one works 100% on Pro, but seems to have some problems with std…
Sorry, but I’ll figure it ou a bit later… no time for now )
And for IE added check for existence (on 7,8 gave me errors…)
[code] function correctcalendarvalue(pform,pid)
{
if (typeof(pform.itemPull[pform.idPrefix+pid]) != ‘undefined’)
{
if (pform.itemPull[pform.idPrefix+pid]._type == “calendar” )
{
pform.itemPull[pform.idPrefix+pid]._value = pform.getInput(pid).value;
thx to MiSchn1 that noticed problems in blocked calendars, i came up with even simplier solution…
And even more dirtier ) But still - works… Now in any conditions…
function correctcalendarvalue_all(pform,pid)
{
if (! pform.isItem("n_"+pid))
{
pform._addItem("hidden", "n_"+pid, "");// sId, lp)
}
pform.setItemValue("n_"+pid,pform.getInput(pid).value);
}
All you have to do is catch dates not in “ITEM_NAME” at DB side, but in “N_ITEM_NAME”.
As I said - dirty… But works.