Forum

Thread tagged as: Question, Blog, Members

Comments form

Hi,

I've created a private blog where only members can view. I want to be able to enable comments on the posts but I want to pull the data from the member account onto the form, name etc. Is there a way to do this? comment_form.html

~~~<perch:if id="postAllowComments" value="1">

<perch:form id="comment" method="post" app="perch_blog" class="comment-form" action="<perch:blog id="postURL" />">
    <fieldset>
       <legend>Leave a comment</legend>
        <div>
            <perch:label for="commentName">Name</perch:label>
            <perch:input type="text" id="commentName" 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" 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="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="postID" value="<perch:blog id="postID" />" />
            <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>

</perch:if>

~~~

Jade Marling

Jade Marling 0 points

  • 2 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Due to the parse order, you may just be able to nest Members tags inside the value attribute of your form fields.

https://docs.grabaperch.com/templates/apps/members/data/

Give a try and let me know if that doesn't work.