Change SQL Output in Checkbox Element

Bodaggnmo

New Member
Hi,

i'm using the Checkbox plugin in some Elements.
I entered the Value X, and then saw in the Database the Output is ["X"]. But i just wanted to get the X without [""]. So i went to the Code Checkbox.php and changed the Code in line 188 from:

$json_val = '["' . $val . '"]';

to

$json_val = $val;

Unfortunatelly it doesn't work, but i didn't found any other line in the Code, where the [" "] is added to the X.

Does anybody know why?

Background: The Database which is linked to the Fabrik list is not a new one, it hast more then 1500 entrys and i Need the correct Inputs in the Database from the Fabrik list.

Best regards
 
A checkbox element is an element for holding multiple values and [""] is JSON for storing such values, so what do you expect to get?
If you only want to handle a single value you can use a radiobutton element.

If you want to modify the stored value you can use a form php plugin running onAfter.
But I don't know if Fabrik will accept a single X as data for a checkbox element when you then call this record in list/form/details view.
 
Sorry, i'm really new to coding, so thank's for you Explanation that [""] is JSON.
The Radiobutton ist exactly what i Need :)
 
But I don't know if Fabrik will accept a single X as data for a checkbox element when you then call this record in list/form/details view.

No, it won't. Although that would come back as a value from our JSONtoData() function (even though it's not JSON), but as a single value, and the checkbox code expects an array.

-- hugh
 
Thank you for your helf. If somebody other has the same question, use the radiobutton plugin.

Maybe you can help me with one more question, because i don't know the right Syntax for, let it me say "Fabrik SQL". Before i used a perl script to get MS Excel Content to SQL. Now im changing the System to joomla Fabrik. I have to update columns, which are not represented as Elements in the joomla Fabrik list. My commands for this have been:

my $statement_handle = $dbh->prepare("update master_table set viewset_de = IFNULL (document_title, document_title_en)");
$statement_handle->execute();


my $statement_handle = $dbh->prepare('update master_table
set type_sort = CONCAT(type_sort,"A")
where process_doc = "x"');
$statement_handle->execute();

Now i think i have to put the SQL Querys in the PHP form plugin?! But what is the right Syntax?

Thank you!
 
Last edited:
Code:
// fetch the db and query objects
$db = JFactory->getDbo();
$query = $db->getQuery(true);

// set up and execute first query
$query->update('master_table')
   ->set('viewset_de = IFNULL (document_title, document_title_en)');
$db->setQuery($query);
$db->execute();

// clear the query object, then set up and execute the second query
$query->clear()
   ->update('master_table')
   ->set(' type_sort = CONCAT(type_sort,"A")')
   ->where('process_doc = "x"');
$db->setQuery($query);
$db->execute();

https://docs.joomla.org/Inserting,_Updating_and_Removing_data_using_JDatabase

-- hugh
 
Back
Top