I am using safecracker for users to create and edit content. When the entry is set to a status I have named "validated" the users can't edit the entry anymore and it uses a different template.

My issue is with a textarea and formatting. When I have the formatting for the text field as "none", the textarea in the safecracker edit field returns the content with the right returns. When the entry gets validated it comes out as one huge paragraph because there are no <p> tags or <br> tags. When I set it to "auto <br>" or "xhtml" I get the tags that I need for the "validated" page, but these tags show up in safecracker edit field.

Is there a way to override how a field is formatted from the template so my edit template would not add <br> tags to the field but the "validated" template would?

I don't want richtext, I just want a <br> tag for a return but I don't want the user to see tags on the edit page. This text field is in Matrix if that makes any difference.

  • Can you post your Safecracker form code? Your content should definitely not be getting formatted when output inside the form. May 16 '13 at 12:31
  • Because of your comment I did some more digging and I see that it's probably a Matrix issue. Text field outside of Matrix is not formatted when in a Safecracker form. Thanks. I think using a plugin to strip the tags will be my workaround: devot-ee.com/add-ons/remove-html May 16 '13 at 14:00
  • Alternately - keep all your formatting as "none", then format the field in your templates using plugin tags. (e.g., github.com/EllisLab/Xhtml). May 16 '13 at 14:07

Your Answer

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

Browse other questions tagged or ask your own question.