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.

  • 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 Apr 8 '13 at 0:27
  • Might want to rephrase the question to specifically address multiple rows being added. "Best practices" is sort of vague... – Michael Rog Jul 9 '13 at 16:45
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.

| improve this answer | |

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.