Incorrect integer value: '' for column 'user' at row 1

Status
Not open for further replies.

prophoto

Active Member
Getting above error when editing and saving a record. User field stores the UserID, its set to display username. Update on edit is set to No.
 
Replicatable, but only if the element is editable + no user selected.
You can fix it by adding
PHP:
//Force the "Please select" value to integer; user element extends dbjoin which has '' as default value
$d->options[0]->value = (int)$d->options[0]->value;
in ...plugins\fabrik_element\user\layouts\fabrik-element-user-form-dropdownlist.php
 
Where should I be adding it? What line?


<?php

defined('JPATH_BASE') or die;


use Joomla\CMS\HTML\HTMLHelper;


$d = $displayData;


echo HTMLHelper::_('select.genericlist', $d->options, $d->name, $d->attributes, 'value', 'text', $d->default, $d->id);
 
I may not have given you all the info. This is only an issue when the field is HIDDEN. Should we be updating the code in fabrik-element-user-form.php instead?

Output:
<input type="hidden" name="ccb_fabrik_pilots___user[]" value="" id="ccb_fabrik_pilots___user">
 
This is only an issue when the field is HIDDEN.
I can't replicate.
If the field is hidden it's inserting the logged-in user's id (resp. userid 0 for guests) without issue.

Which exact Fabrik, Joomla, php version are you running?
Which version of user and databasejoin plugin?

The code goes after $d=$displaData;
 
I tried your code after $d= but didn't work.

Database Type mysql
Database Version 5.7.38-log
Database Collation utf8_general_ci
Database Connection Collation utf8mb4_general_ci
Database Connection Encryption None
Database Server Supports Connection Encryption Yes
PHP Version 8.1.13
Web Server Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips mod_fcgid/2.3.9
WebServer to PHP Interface fpm-fcgi
Joomla! Version Joomla! 4.2.7 Stable [ Uaminifu ] 31-January-2023 15:00 GMT
 
Damn missed that. No repeat groups, nothing special. Just a user field to filter user who created the record in a list. f4.0beta4b.

Works fine at new, throws error at save since value is empty.
 
Ok, is this an updated F3 site with existing data?
And you are trying to edit a record which already was existing in F3?

Can you have a look directly in your DB (e.g. with phpMyAdmin) what is stored in the user column?

Can you try
Code:
$d = $displayData;
if (!isset($d->value) || empty($d->value) ) $d->value = 0;
in plugins\fabrik_element\user\layouts\fabrik-element-user-form.php
 
Last edited:
New records are unaffected by this bug. Checked the db, your code is changing the db value from my=>id (say, 877) to zero (0) upon edit/save. Error is gone, bug still not fixed. We took one more step, value is no longer empty in the field but now its being replaced with 0.
 
I can't replicate with my F4 site.
What are your exact user element settings (including Access settings)?
 
No Access settings changed.
 

Attachments

  • Screenshot 2023-02-11 at 5.24.49 PM.png
    Screenshot 2023-02-11 at 5.24.49 PM.png
    74.3 KB · Views: 62
  • Screenshot 2023-02-11 at 5.24.44 PM.png
    Screenshot 2023-02-11 at 5.24.44 PM.png
    71.6 KB · Views: 61
Is the element in a group created by a list join?
What are the exact steps to replicate?
 
I'm having a very similar problem. This is a J3/f3 site that I recently upgraded. With one table (at least), I Store row failed: INSERT INTO `members`...Incorrect integer value: '' for column 'id' at row 1 ;

The id column is hidden. I don't have this problem with another table, so I checked to see if there was any difference in boats.id vs members.id but the columns are identically configured in the db. Been playing, but I can't seem to find anything that explains why it happens with one table but not the other.

Mysql version is 5.7.39-42. Fabrik version is gamma. I also see this error sometimes:
Warning: Undefined property: stdClass::$members___id_raw in /home/customer/www/mydyc.ca/public_html/plugins/fabrik_element/fileupload/fileupload.php on line 1940
 
Last edited:
Okay, I think it wasn't set to auto increment (pretty sure it was set to do so before upgrading) and the problems I had after switching were with other fields. So, I think all is well. thanks for the help trouser!
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top