• New Commercial Services Section

    We have now opened a commercial services section here on the forum. If you have a Fabrik project that you wish to have someone work on for you, post it under Help Wanted. If you are an application developer and wish to earn some money helping others, post your details under Fabrik Application Developers.

    Both of these are unmoderated. It will be up to both parties to work out the details and come to an agreement.

issues with the date field

Status
Not open for further replies.

shortbow

New Member
Hi,
I'm running joomla 3.9.19 with fabrik version 3.9.2 (updated recently),
And when I did the update on fabrik got an issue with date fields I had not any poblem before

the user would edit the date\time... thet where doing this by editing directly without the time selector but now that is not possible because the field do not register the time, it goes to 00:00 when the user changes the focus to another object.

I had php plugin in the event "start of form submission" to process the date/time
So... I got da date/time from the form :
$datho_ent = $formModel->getElementData('dataho_ent', true);
$datho_rec = $formModel->getElementData('dataho_rec', true);

and then I would do an update on a table :
$myQuery->clear();
$myQuery->update('jooro')
->set('dataho_entrega= ' . $myDb->quote($datho_ent ))
->set('dataho_recolha= ' . $myDb->quote($datho_rec ))
->set('dat_trans = ' . $myDb->quote($datho_rec ))
->set('ho= ' . $myDb->quote($datho_rec ))
->set('maqid= ' . (int) $maqid)
->where($conditions1);
$myDb->setQuery($myQuery);
$myDb->execute();

but right now is not doing nothing and giving back the error :
"Unknown column 'Array' in 'field list'"

My guess is the date\time has passed to become an array but I've tried to capture the variable has an array and tried diferente positions in the array but got nothing back...
//$foo3=$formModel->getElementData('dataho_ent', true);
//$datho_ent = is_array($foo3) ? $foo3[1] : $foo3;



I'm sure I'm probably not seeing something very obvious but sadly I'm stuck and I do have to make the upgrade in my production site, so I got to solve this, any help is very much apreciated...
 
Yes, in Fabrik3.9.2 the date element must have set time selector=yes to show/record the time (if it's not hidden).

The Array: var_dump ($datho_ent); etc (or use jdump plugin) to see what you get."

hi, the var dump gives me:
string(7) "entrega" array(2) { ["date"]=> string(19) "2020-07-09 10:00:00" ["time"]=> string(8) "10:00:00" }

sorry for my ignorance, but I don't understand whats telling me.
I've tried to access the variable has an array and get position 2 but I get NULL

$foo3=$formModel->getElementData('dataho_ent', true);
$datho_ent = is_array($foo3) ? $foo3[2] : $foo3;
var_dump("entrega",$datho_ent );
exit;

[QUOTE="I think (didn't test) getElementData needs the full element name (your_table___dataho_ent)
http://fabrikar.com/forums/index.php?wiki/php-form-plugin/#accessing-form-data"[/QUOTE]
I'm doing it, I just masked a bit the variables and field names...
 
So
$foo3=$formModel->getElementData('dataho_ent', true);
$datho_ent = is_array($foo3) ? $foo3['date'] : $foo3;
should do.
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top