1

I'm trying to get Matrix to work inside my Zoo Visitor Registration form... I have this:

{exp:zoo_visitor:registration_form return="{current_url}"}

    {embed="_functions/_course-list-matrix"}

{/exp:zoo_visitor:registration_form}

Then inside the embed I have:

{exp:channel:entries channel="course" dynamic="no"}
    <li>
        <label>{title}</label>
        <input type="checkbox" value="">

        {!-- Matrix Fields --}

        {!-- Create New Row --}
        <input type="hidden" name="member_courses[row_order][]" value="row_new_0">

        {!-- Course ID / Name --}
        <input type="hidden" name="member_courses[row_new_0][col_id_20]" value="[{entry_id}] [{url_title}] {title}">

    </li>
{/exp:channel:entries}

The registration form submits perfectly. But the Matrix field is just blank. I've double checked the field name and also the col ID numerous times and it's not doing anything...

1

Are you using the embed in an attempt to submit data to two different channels with a single form? (Zoo Visitor, presumably, triggers a Safecracker submission to a defined members channel? - I've not used it before).

If this is the case it can't be done natively without some convoluted client-side ajax.

I built something similar using my Bankcracker add-on, which may help:

https://github.com/thisisjamessmith/Bankcracker

...However I've not tested it extensively, and not at all with Matrix... but in theory it should work since it just triggers multiple Safecracker submissions per channel.

UPDATE

Ah right, based on comments below I think I understand better.

Try changing your hidden inputs for these:

<input type="hidden" name="member_courses[row_order][]" value="row_new_{count}">
<input type="hidden" name="member_courses[row_new_{count}][col_id_20][]" value="[{entry_id}] [{url_title}] {title}">

I've added the count variable so each row is not named the same, and also added [] at the end of the second name so that multiple courses can be ticked without overwriting each other. A possible problem here is that the count will be 1 ahead of where it should be, but that might not be an issue(?) If it is you could use one of the math plugins to minus one from the count.

Take a look at these two resources for further details:

http://bluefishdesignstudio.com/blog/article/breaking-up-a-matrix-field-for-use-in-a-safecracker-form http://themetaq.com/articles/bring-matrix-data-editing-to-the-front-end

5
  • No, just submitting the data in to one channel entry, not multiple. The embed is used so I can put the channel:entries inside the Zoo tags.
    – Jason Mayo
    May 7 '13 at 10:09
  • so you're storing your member registration data in the 'course' channel? May 7 '13 at 10:58
  • This doesn't make much sense... the registration_form tag will be attempting to create a new entry in your members channel, yet via your embed it looks like you're attempting to simultaneously update existing entries with new matrix rows. Maybe this helps: devot-ee.com/add-ons/support/zoo-visitor/viewthread/5727 May 7 '13 at 11:05
  • No, I have a Matrix field in 'Members' entry called 'Courses' which is why I have this... member_courses[row_order][]
    – Jason Mayo
    May 8 '13 at 10:31
  • oh right, I see - have updated my answer May 8 '13 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.