Forum

Thread tagged as: Comments

Perch Comments App

Hi,

Can you add custom fields to the comments APP? They appear on the form itself but not in the admin area.

I can't seem to get anything other than commentName, comment Email, commentwebsite and commentHTML to work. I was looking to use it to allow people to submit basic listings that then needed to be approved but I'm starting to get the impression this can't be done through the comments APP.

Any ideas?

Cheers Steve

Steven Bradley

Steven Bradley 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Should work - are you adding the fields to the comments/comment.html template?

Hi, Yes. It doesn't mater what I do it seems to stay with the original fields in the admin area. The code below I've added a Phone but to no joy.

<perch:form id="comment" method="post" app="perch_comments">
    <fieldset>
       <legend>Add a Listing</legend>
        <div>
            <perch:label for="commentName">Name</perch:label>
            <perch:input type="text" id="commentName" size="15" required="true" label="Name" antispam="name" />
            <perch:error for="commentName" type="required">Required</perch:error>
        </div>
        <div>
            <perch:label for="commentEmail">Email</perch:label>
            <perch:input type="email" id="commentEmail" size="15" required="true" label="Email" antispam="email" />
            <perch:error for="commentEmail" type="required">Required</perch:error>
            <perch:error for="commentEmail" type="format">Check format of address</perch:error>
        </div>

        <div>
            <perch:label for="commentPhone">Phone</perch:label>
          <perch:input type="text" id="commentPhone" size="15" label="Phone" />

        </div>

           <div>
            <perch:label for="datepicker">Date</perch:label>
           <p><perch:input type="text" id="datepicker"  /></p>


            <perch:error for="datepicker" type="required">Required</perch:error>

        </div>



      <div>
            <perch:label for="commentURL">Website</perch:label>
            <perch:input type="url" id="commentURL" placeholder="https://" label="URL" antispam="url" />
        </div>
        <div>
            <perch:label for="commentHTML">Comment</perch:label>
            <perch:input type="textarea" id="commentHTML" required="true" label="Message" antispam="body" />
            <perch:error for="commentHTML" type="required">Required</perch:error>
        </div>
        <div>
            <perch:input type="hidden" id="parentID" value="<perch:comments id="parentID" />" />
            <perch:input type="hidden" id="parentTitle" value="<perch:comments id="parentTitle" />" />
            <perch:input type="submit" id="submitComment" value="Submit" />
        </div>

    </fieldset>
    <perch:success>
        <p>Thank you. Your comment has been submitted and will appear on the site once approved.</p>
    </perch:success>

</perch:form>

It's strange - it is adding the extra fields to commentDynamicFields in the database;

{"commentPhone":"0191222222","datepicker":"06\/26\/2015","submitComment":"Submit"}
Drew McLellan

Drew McLellan 2638 points
Perch Support

That looks a lot like comment_form.html. Have you added the fields to comment.html ?

Cheers, Yep using wrong one. :)