Update Field / Loop / Save

jformicola 31 Jan, 2020
Please help. I'm copying the dynamic actions DEMO, but I can't get the update functionality to work on my form. I've got it to the point where the form loads the data, I can edit it, but my update button doesn't seem to do anything. I'm going to include a screen shot of everything below. Please help.

Update Field  / Loop / Save image 1

Debugger (Array that loads when the connection loads, there is a bunch of fake data in there from when I was testing the "new" buttton)





Array
(
    [Itemid] => 279
    [option] => com_chronoconnectivity6
    [view] => connection
)
Array
(
    [subject] => Array
        (
            [log] => Array
                (
                )

            [var] => Array
                (
                    [0] => Array
                        (
                            [subject] => Array
                                (
                                    [ID] => 1
                                    [Subject] => MRI - Changing Database
                                    [Notes_For_Trainer] => Do before 9:30, You won't be able to if there are items on any calendar
                                    [Instruction_Resource_1] => 
                                    [Instruction_Resource_2] => 
                                )

                        )

                    [1] => Array
                        (
                            [subject] => Array
                                (
                                    [ID] => 2
                                    [Subject] => MRI - Calendar - Advancing the date
                                    [Notes_For_Trainer] => 
                                    [Instruction_Resource_1] => http://trainkamson.com/index.php/instruction/1-mri-manual/file#page=8
                                    [Instruction_Resource_2] => 
                                )

                        )

                    [2] => Array
                        (
                            [subject] => Array
                                (
                                    [ID] => 3
                                    [Subject] => MRI - Calendar - Navigating
                                    [Notes_For_Trainer] => Be sure the trainee knows how to look forward and behind and is clear on the distinction between advancing and navigating.
                                    [Instruction_Resource_1] => http://trainkamson.com/index.php/instruction/1-mri-manual/file#page=6
                                    [Instruction_Resource_2] => 
                                )

                        )

                    [3] => Array
                        (
                            [subject] => Array
                                (
                                    [ID] => 4
                                    [Subject] => Your Requested Information About Lakeview Apartments
                                    [Notes_For_Trainer] => asdfasdf
                                    [Instruction_Resource_1] => asdfasdfad
                                    [Instruction_Resource_2] => asdfasdf
                                )

                        )

                    [4] => Array
                        (
                            [subject] => Array
                                (
                                    [ID] => 5
                                    [Subject] => Lakeview Apartments Information
                                    [Notes_For_Trainer] => asdfasdf
                                    [Instruction_Resource_1] => asdfasdfad
                                    [Instruction_Resource_2] => asdfasdf
                                )

                        )

                    [5] => Array
                        (
                            [subject] => Array
                                (
                                    [ID] => 6
                                    [Subject] => asdfdasf
                                    [Notes_For_Trainer] => 
                                    [Instruction_Resource_1] => 
                                    [Instruction_Resource_2] => 
                                )

                        )

                    [6] => Array
                        (
                            [subject] => Array
                                (
                                    [ID] => 7
                                    [Subject] => aaaaaaa
                                    [Notes_For_Trainer] => 
                                    [Instruction_Resource_1] => 
                                    [Instruction_Resource_2] => 
                                )

                        )

                    [7] => Array
                        (
                            [subject] => Array
                                (
                                    [ID] => 8
                                    [Subject] => bbb
                                    [Notes_For_Trainer] => 
                                    [Instruction_Resource_1] => 
                                    [Instruction_Resource_2] => 
                                )

                        )

                    [8] => Array
                        (
                            [subject] => Array
                                (
                                    [ID] => 9
                                    [Subject] => ccc
                                    [Notes_For_Trainer] => 
                                    [Instruction_Resource_1] => 
                                    [Instruction_Resource_2] => 
                                )

                        )

                    [9] => Array
                        (
                            [subject] => Array
                                (
                                    [ID] => 10
                                    [Subject] => fdfdf
                                    [Notes_For_Trainer] => dfdfd
                                    [Instruction_Resource_1] => dfdfd
                                    [Instruction_Resource_2] => dfdfd
                                )

                        )

                    [10] => Array
                        (
                            [subject] => Array
                                (
                                    [ID] => 11
                                    [Subject] => bbb
                                    [Notes_For_Trainer] => bbb
                                    [Instruction_Resource_1] => bbb
                                    [Instruction_Resource_2] => bbb
                                )

                        )

                    [11] => Array
                        (
                            [subject] => Array
                                (
                                    [ID] => 12
                                    [Subject] => vvv
                                    [Notes_For_Trainer] => vvv
                                    [Instruction_Resource_1] => vvv
                                    [Instruction_Resource_2] => vvv
                                )

                        )

                )

        )

)
Update Field  / Loop / Save image 2Update Field  / Loop / Save image 3Update Field  / Loop / Save image 4Update Field  / Loop / Save image 5Update Field  / Loop / Save image 6Update Field  / Loop / Save image 7
Update Field  / Loop / Save image 8
Update Field  / Loop / Save image 9
Update Field  / Loop / Save image 10
Update Field  / Loop / Save image 11
Update Field  / Loop / Save image 12
Update Field  / Loop / Save image 13
Update Field  / Loop / Save image 14
Update Field  / Loop / Save image 15
Update Field  / Loop / Save image 16
Update Field  / Loop / Save image 17
Update Field  / Loop / Save image 18
Update Field  / Loop / Save image 19
healyhatman 31 Jan, 2020
There's a lot of pictures there that I can't follow all of them but just be aware that in an event, nothing after {redirect: in your event will actually happen. Unless you specifically need a redirect you should use {event:

If you press F12 and go to the Network tab, and THEN click update, one of the things you see will be the data your form sends to the server and its response. Have a look at that
ieraora 02 Feb, 2020
Hi jformicola, than you for you screenshot, with these I resolved my questions in this post
https://www.chronoengine.com/forums/posts/t108015/loop-multiple-field.
jformicola 04 Feb, 2020
Healyhatman - Thanks, but I don't understand your comment. Where do I hit f12? The redirect isn't the issue from what I can tell, I removed it.

Ieraroa - Thank you for your comment, I'm glad that my confusion helped you out somehow. I've tried to use your screenshots in conjunction with the demo setup and the best I can manage thus far is to get one field to update. I've tried using your screenshots to be able to update multiple, but to no avail.

Here are the debugs and some screen shots of the configuration I have now, which is allowing me to update just the "Subject" field. If someone could tell me how to now make it so I can update the remaining three fields at the same time, that would be helpful.

Healy - I was thinking about throwing a donation your way for the last one you helped me with, where do I do that? Please help!!!!

Update Field  / Loop / Save image 20

Update Field  / Loop / Save image 21

Update Field  / Loop / Save image 22
Update Field  / Loop / Save image 23
Update Field  / Loop / Save image 24
Update Field  / Loop / Save image 25
Update Field  / Loop / Save image 26
Update Field  / Loop / Save image 27


After update:





Array
(
    [conn] => add-edit-training-subjects-topics
    [event] => update
    [subject] => Array
        (
            [1] => PHYSICS
            [2] => Start with chapter4
            [3] => asdfadsf
            [4] => asdfdasf
            [15] => MATH
            [16] => Start with Chapter1
            [17] => http://Resource1
            [18] => http://resource2
            [14] => EXCEL
            [19] => Start with chapter 5
            [20] => asdf
            [21] => asdf
        )

    [Itemid] => 279
    [option] => com_chronoconnectivity6
    [view] => connection
)
Array
(
    [update_subject] => Array
        (
            [data] => Array
                (
                    [conn] => add-edit-training-subjects-topics
                    [event] => update
                    [subject] => asdf
                    [Itemid] => 279
                    [option] => com_chronoconnectivity6
                    [view] => connection
                )

            [_success] => Data saved successfully
            [log] => Array
                (
                    [0] => UPDATE `tbltrainedtopics` AS `subject` SET `subject` = 'asdf' WHERE `ID` = '21';
                )

            [var] => Array
                (
                    [subject] => asdf
                )

        )

)

On load:





Array
(
    [Itemid] => 279
    [option] => com_chronoconnectivity6
    [view] => connection
)
Array
(
    [read_data] => Array
        (
            [log] => Array
                (
                    [0] => SELECT COUNT(`data`.`ID`) AS `data.count` FROM `tbltrainedtopics` AS `data`;
                    [1] => SELECT `data`.`ID` AS `data.ID`, `data`.`subject` AS `data.subject`, `data`.`Notes_For_Trainer` AS `data.Notes_For_Trainer`, `data`.`Instruction_Resource_1` AS `data.Instruction_Resource_1`, `data`.`Instruction_Resource_2` AS `data.Instruction_Resource_2` FROM `tbltrainedtopics` AS `data` LIMIT 30;
                )

            [var] => Array
                (
                    [0] => Array
                        (
                            [data] => Array
                                (
                                    [ID] => 1
                                    [subject] => ENGLISH
                                    [Notes_For_Trainer] => Start with chapter4
                                    [Instruction_Resource_1] => asdfadsf
                                    [Instruction_Resource_2] => asdfdasf
                                )

                        )

                    [1] => Array
                        (
                            [data] => Array
                                (
                                    [ID] => 15
                                    [subject] => MATH
                                    [Notes_For_Trainer] => Start with Chapter1
                                    [Instruction_Resource_1] => http://Resource1
                                    [Instruction_Resource_2] => http://resource2
                                )

                        )

                    [2] => Array
                        (
                            [data] => Array
                                (
                                    [ID] => 14
                                    [subject] => EXCEL
                                    [Notes_For_Trainer] => Start with chapter 5
                                    [Instruction_Resource_1] => asdf
                                    [Instruction_Resource_2] => asdf
                                )

                        )

                )

        )

)
healyhatman 04 Feb, 2020
Answer
You have your text fields named incorrectly it looks like. They should be of the form group[number][name]. So for example your subject field should be called
groupname[{var:table1.row.data.id}][subject]
and then you loop through {data:groupname}, and the value will be retrieved in each loop from {var:loop_event_name.row.subject}
jformicola 04 Feb, 2020
That worked! Thanks so much! I'll make a donation🙂

One further question - in my haste to get this to work, I ended up destroying the work I did on the "new" button (it was working at one point). Do I have to create another set of fields to use in the "Form Area" section that the "new" button event points to?


Thanks again!
jformicola 05 Feb, 2020
I ended up adding new text fields for the "New" button and everything seems to be working. Thanks again for your help!

g'day mate!
This topic is locked and no more replies can be posted.