Jump to:

2011 Posts in 1436 Topics by 620 members

Form Questions

SilverStripe Forums » Form Questions » Spurious <p>'s surrounding Form, when $UserDefinedForm used in content area

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 442 Views
  • vwd
    Community Member
    158 Posts

    Spurious <p>'s surrounding Form, when $UserDefinedForm used in content area Link to this post


    I've noticed that when I use $UserDefinedForm in the content area of a user form, that spurious empty paragraphs are inserted surrounding the form

    In Content editor of CMS

    <p>Before my form</p>
    <p>After my form</p>

    Generated HTML

    <p>Before my form</p>
    <p></p> <!--These are the offending paragraph tags inserted -->

    <form id="Form_Form" action="/myform/Form" method="post" enctype="application/x-www-form-urlencoded">

    <p></p> <!--These are the offending paragraph tags inserted -->
    <p>After my form</p>

    However when I don't use $UserDefinedForm, no spurious <p> tags are inserted. Looking at methods UserDefinedForm_Controller::index() and UserDefinedForm_Controller::Form() in UserDefinedForm.php, it looks like the default theme template is used to when $UserDefinedForm is not used in the content area (ie $Form from the themes template is used to render the form).

    Any ideas which template is inserting these <p> tags? I've tried to use ?showtemplate=1 but can't quite see who's responsible.

    Thanks very much.


    (I'm using the latest version of UserForms from github)

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.