2

I have a safecracker form with 4 very similar ( a few of the same colmumn names ) Matrix fields. When I click the + button to add a row to one of the Matrix fields it adds 4 rows each with a number 1 on the rows. The second field add three rows with a number one and third adds two rows with a number one.

2
  • Hi, JSweeney - can you post your template code and screenshots of your Matrix setups? Is this multiple Safecracker forms on one page? Also version numbers would help out here - for EE and Matrix. Thank you!
    – Lisa
    Commented Apr 8, 2013 at 0:27
  • Might want to rephrase the question to specifically address multiple rows being added. "Best practices" is sort of vague... Commented Jul 9, 2013 at 16:45

1 Answer 1

2

Matrix is smart enough to know one unique Matrix field from another. But, are you using template conditionals to do any display logic? If so, you might have the field tags for each unique field appearing more than once in the template.

(If you are inadvertently initializing the same fields more than once, the JavaScript would be included more than once on the page, causing duplicate actions to occur on various events.)

For example, something like...

{if segment_X}
  Edit entry #{segment_X}:
  {field:my_field_name}
{if:else}
  Add a new entry:
  {field:my_field_name}
{/if}

...could cause the sort of issue you're describing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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