Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Form Questions /

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

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


Go to End
Reply


633 Views

Avatar
vwd

Community Member, 160 Posts

25 November 2011 at 12:19pm

Hi,

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>
    $UserDefinedForm
    <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">
        ...
    </form>

    <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.

VWD.

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