ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Input fields for safecracker relationships must be arrays in EE 2.6

May 01, 2013 3:24pm

Subscribe [3]
  • #1 / May 01, 2013 3:24pm

    truffl

    4 posts

    In version 2.5, you could add the following to a SafeCracker form:

    <input type=“hidden” name=“relationship_field” value=“ENTRYIDOFRELATED” />

    This throws PHP errors in EE 2.6 because they expect the field to be an array like this:

    <input type=“hidden” name=“relationship_field[data][]” value=“ENTRYIDOFRELATED” />

    This is a bug introduced in EE 2.6 that makes forms created with 2.5.x break. The relationship validation should accept either an atomic value or an array.

    The solution is to change the syntax of the hidden field as indicated above.

  • #2 / May 20, 2013 7:45am

    Clive Portman

    83 posts

    Good work, Truffl. I couldn’t see this in the Docs - is it there?

  • #3 / Jul 31, 2013 5:34am

    Fred2341

    25 posts

    Hi
    thanks for the info, which is very helpful.
    However, when I use Safecracker to partially update a record and I don’t include the relationship field, I still get the errors.
    Does that mean I always have to include relationship fields in the form?

    Fred

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases