Forums

Multiplier - debug giving error in array

fribse 24 Apr, 2016
Hi Guys

I'm working my way through my form where I use the multiplier function.
The multiplier function is supposed to handle participants in the boat trip (called deltager in danish):

The multiplier has the following:
Replacer: ###
Counter: 1
Hide First: Yes
Disable First: Yes
Hide Buttons: No
Start Count: 4
datapath: deltager

In the Mutiplier-Content I have a multifield:
deltager[###][navn]
deltager[###][gaest]
deltager[###][koersel]
deltager[###][baad]
deltager[###][slaeg]
deltager[###][bro]

First of, I don't see four repeats of the multiplier-content from the start, wasn't that what 'start count' was supposed to do?
Secondly, when I look in the debug in 'on submit' I see these results:

Data array
Array
(
    [option] => com_chronoforms5
    [chronoform] => TripCalculator
    [event] => submit
    [tur] => ada
    [dato] => 24-04-2016
    [takt] => 2
    [benzin] => 100
    [liter] => 10
    [km] => 120
    [slaeb] => 100
    [bro] => 0
    [bad] => 100
    [deltager] => Array
        (
            [1] => Array
                (
                    [navn] => kenneth
                    [gaest] => 0
                    [koersel] => 1
                    [slaebested] => 0
                    [broudgift] => 0
                )

            [2] => Array
                (
                    [navn] => søren
                    [gaest] => 0
                    [koersel] => 0
                    [slaebested] => 0
                    [broudgift] => 0
                )

            [3] => Array
                (
                    [navn] => birger
                    [gaest] => 0
                    [koersel] => 0
                    [slaebested] => 1
                    [broudgift] => 0
                )

        )

    [beregn] => Beregn tur
    [562929373c2284f917b78d7bcc8aa1b2] => 
)

Data Array
Array
(
)

Errors
Array
(
)

Debug Info
Array
(
)

What is this with 'Errors'???
fribse 24 Apr, 2016
I think I understand now, the 'Errors' part is empty, ie. no error in the form 😀

Now how do I get the array values to work with?
I've tried doing
$form->data['deltager[$i][1]'] and $form->data['deltager[$i][navn]']
but that doesn't return anything, how is the format for it?
GreyHead 24 Apr, 2016
Answer
Hi fribse,

It's just the standard PHP array format $form->data['deltager'][1]['navn'] . . . exactly as you see it in the Debugger output.

Bob
fribse 24 Apr, 2016
1 Likes
Hi Bob

Well for me and my VERY limited PHP experience, it's not 'just' 😀
It works perfectly, thankyou.
This topic is locked and no more replies can be posted.