Hi!
I have a form that ckecks if the record exist or if it is a new record. If it exist it loads another form with values from the record. For this I use DB Record Loader in the second form.
My problem is that the group for checkboxes only fills in the first value.
The array looks like this:
Value [0] there is no space but in the other there is. B1 is checked but B2 and B3 is unchecked.
I found a similar problem in the forum and tried to explode the array but that did not help. Also I have tried to add a space in "Array separator" in advanced settings for DB Loader.
Any idee?
//JeLu
I have a form that ckecks if the record exist or if it is a new record. If it exist it loads another form with values from the record. For this I use DB Record Loader in the second form.
My problem is that the group for checkboxes only fills in the first value.
The array looks like this:
[check2] => Array
(
[0] => B1
[1] => B2
[2] => B3
)
Value [0] there is no space but in the other there is. B1 is checked but B2 and B3 is unchecked.
I found a similar problem in the forum and tried to explode the array but that did not help. Also I have tried to add a space in "Array separator" in advanced settings for DB Loader.
Any idee?
//JeLu
Hi JeLu,
How is the data saved in the database? What do you see if you add a Debugger to the form?
Bob
How is the data saved in the database? What do you see if you add a Debugger to the form?
Bob
In the record the checkbox-group is stored like B1, B2, B3 and debugger info about array is like this
As you see it is a space before value [1] and value [2] but not in front of value [0].
The data I have to pick up is from an old form running ChronoForm 3 and joomla 1.5.
I need the values but in CF 4 and Joomla 3
it is about 10 000 records and I hope not to delete spaces in every checkbox-group for all that records.
//JeLu
[check2] => Array
(
[0] => B1
[1] => B2
[2] => B3
)
As you see it is a space before value [1] and value [2] but not in front of value [0].
The data I have to pick up is from an old form running ChronoForm 3 and joomla 1.5.
I need the values but in CF 4 and Joomla 3
it is about 10 000 records and I hope not to delete spaces in every checkbox-group for all that records.
//JeLu
Hi JeLu,
On the Advanced tab in the DB MultiRecord Loader action is an Array Separators box, please try setting that to ', ' that is comma followed by a space.
Bob
On the Advanced tab in the DB MultiRecord Loader action is an Array Separators box, please try setting that to ', ' that is comma followed by a space.
Bob
Hi!
I have tried that but it did not work. I noticed that any new record I create with my CF4 form are saved without spaces and those records are shown as they should.
But I need to access all the old records too 🙄
//JeLu
I have tried that but it did not work. I noticed that any new record I create with my CF4 form are saved without spaces and those records are shown as they should.
But I need to access all the old records too 🙄
//JeLu
[check1] => Array
(
[0] => A2
[1] => A3
[2] => A4
This is what debugger says about Checkboxgroup check1
[attachment=0]check1.jpg[/attachment]
Can I strip the array when load a record for edit. There is no problem with a value in the records without spaces. I only need it to pick them up for old records too.
//JeLu
//JeLu
Hi Jelu,
In a Custom Code action you can try this
Or you can use PHPMyAdmin and update the records with something like this (backup the database table first for safety):
Bob
In a Custom Code action you can try this
<?php
if ( is_array($form->data['check1']) && count($form->data['check1']) > 1 ( {
foreach ($form->data['check1'] as $k => $v ) {
$form->data['check1'][$k] = trim($v);
}
}
?>
Or you can use PHPMyAdmin and update the records with something like this (backup the database table first for safety):
UPDATE `table_name`
SET `check1` = REPLACE(`check1`, ', ', ',');
Bob
This topic is locked and no more replies can be posted.
