Forums

Little Problem... Slider Container->Multiplier->user_id

fibernet 07 Dec, 2015
Good morning@all, hello Bob

Last 2 (maybe, i hope :-)) Questions:
My Form:
Slider container with 3 sliders, in the second slider a multiplier container, everything works....so far...

My Problem now: i cannot save the values from the multiplier with the user_id in a seperate db table, everytime the user_id is 0, there will always save a new record. how can I take the user_id in the Multiplier.

My second Problem: in the multiplier Settings the first data set is disabled and hidden, when I load the data with the db_loader, then the second record is only displayed, the first will be ignored. How can i load all records, included the first, in the form.

Here is the data array:
Array
(
    [option] => com_chronoforms5
    [chronoform] => generator
    [event] => submit
    [id] => 36
    [thumb_small] => 20151207095001_20151021093447_team3_small.jpg
    [salutation] => 0
    [forename] => Max
    [surename] => Mustermann
    [street] => Musterstraße 12
    [zip] => 01234
    [city] => Musterstadt
    [birthday] => 11.11.1911
    [phone] => 012345 78900
    [email] => max.mustermann@email.de
    [skill] => Array
        (
            [1] => Array
                (
                    [fromdate] => 03/2015
                    [todate] => 05/2015
                    [company] => Musterfirma
                    [city] => Musterstadt
                    [position] => CEO
                    [industry] => 12
                    [category] => 6
                    [detail] => • Test2
• Test3
• Test4
• 
• 
• 
• 
• 
• 
• 
• 
• 
                [user_id] => 
               )

            [id] => 250
        )

    [user_id] => 339
    [button19] => Speichern
)

and the Debugger log:
Array
(
    [26] => Array
        (
            [DB Save] => Array
                (
                    [Queries] => Array
                        (
                            [0] => INSERT INTO `gvw9q_skill` (`fromdate`, `todate`, `company`, `city`, `position`, `industry`, `category`, `detail`, `user_id`) values ('03/2015', '05/2015', 'Musterfirma', 'Musterstadt', 'CEO', '12', '6', '• Test2
• Test3
• Test4
• 
• 
• 
• 
• 
• 
• 
• 
• ', '');
                        )

                )

        )

    [20] => Array
        (
            [DB Save] => Array
                (
                    [Queries] => Array
                        (
                            [0] => UPDATE `gvw9q_cf_user_profiles` AS `Data` SET `thumb_small` = '20151207095001_20151021093447_team3_small.jpg', `salutation` = '0', `forename` = 'Max', `surename` = 'Mustermann', `street` = 'Musterstraße 12', `zip` = '01234', `city` = 'Musterstadt', `birthday` = '11.11.1911', `phone` = '012345 78900', `email` = 'max.mustermann@email.de', `user_id` = '339', `modified` = '2015-12-07 09:51:53' WHERE `id` = '36';
                        )

                )

        )

)

Thank you very very much for your efforts.....

I've searched the whole forum and the FAQs, but somehow I have tomatoes in the eyes, I am also currently on a construction site and can only surf with the mobile phone ..... amount of data consumed too much
fibernet 07 Dec, 2015

This is private content

fibernet 07 Dec, 2015

This is private content

fibernet 08 Dec, 2015
Ok Problem 1 solved......
<?php
foreach($form->data['skill'] as $k => $v ) {
  $form->data['skill'][$k]['user_id'] = $form->data['user_id'];
}
foreach($form->data['skill'] as $k => $v ) {
  $form->data['skill'][$k]['id'] = $form->data['id'];
}
?>
GreyHead 08 Dec, 2015
HI fibernet,

Well done, You can actually simplify this a little bit more
Ok Problem 1 solved......
<?php
foreach($form->data['skill'] as $k => $v ) {
  $form->data['skill'][$k]['user_id'] = $form->data['user_id'];
  $form->data['skill'][$k]['id'] = $form->data['id'];
}
?>
fibernet 09 Dec, 2015
Good morning.....ok all Problems solved.....
this part : $form->data['skill'][$k]['id'] = $form->data['id']; was not realy nessasary

The problem was, when I load the data, edit and save again, the data is stored as new records. in turn, if I have saved the data dependent on id, these were only updated.... when I added a multiplier field, still this new fields that have been "forgotten".
My solution now: the data loaded into the multiplier area, now you can change or add new data and before the data going stored, the record will be deleted dependent from the user_id and the record will be new created......

custom Code in on_submit

<?php
$user = \JFactory::getUser();
mysql_query("DELETE FROM gvw9q_skill WHERE user_id=$user->id");
?>

The second Problem was a wrong number in the Multiplier Counter (i write 1, a 0 was right)...............this was, what i mean, tomatoes in my eyes..............
This topic is locked and no more replies can be posted.