# Quip how to have a reply link and inline form for threading

**URL:** <https://community.modx.com/t/quip-how-to-have-a-reply-link-and-inline-form-for-threading/3256>\
**Category:** Extras\
**Created:** [October 29, 2020, 7:46pm UTC](https://community.modx.com/t/quip-how-to-have-a-reply-link-and-inline-form-for-threading/3256 "2020-10-29T19:46:09Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![wemyssweb](https://community.modx.com/user_avatar/community.modx.com/wemyssweb/32/903_2.png) [@wemyssweb](https://community.modx.com/u/wemyssweb)\
**Post date:** [October 29, 2020, 7:46pm UTC](https://community.modx.com/t/quip-how-to-have-a-reply-link-and-inline-form-for-threading/3256/1 "2020-10-29T19:46:09Z")

</div>

I would like some advice on how to change threaded comments so that i do not need a new page.  
Just have it appear below the comment with a reply link or button so that it is hidden.

---

<div class="post-metadata">

**Author:** ![halftrainedharry](https://community.modx.com/user_avatar/community.modx.com/halftrainedharry/32/1063_2.png) [@halftrainedharry](https://community.modx.com/u/halftrainedharry)\
**Post date:** [October 31, 2020, 4:16pm UTC](https://community.modx.com/t/quip-how-to-have-a-reply-link-and-inline-form-for-threading/3256/2 "2020-10-31T16:16:30Z")

</div>

It seems that the difference between a threaded and a non-threaded comment is just the value of the input field “parent” in the form.

```auto
<input type="hidden" name="parent" value="0" />

```

The value is “0” if the comment is not a reply to another comment, else the value is the id of the comment you reply to.

With some Javascript code it should be possible to read the “quip\_parent” parameter from the reply-link and write it to input-field “parent” in the form.

```auto
<span class="quip-reply-link"><a href="index.php?id=123&quip_thread=mythread&quip_parent=20">Reply</a></span>

```

Here is some jQuery code to illustrate my point.

```auto
[[!Quip? &thread=`mythread` &replyResourceId=`123`]]
<br />
[[!QuipReply? &thread=`mythread`]]

<script>
$(function() {
    //helper function to get a parameter from a url
    function getUrlParameter(sParam, sPageURL)
    {
    	var sURLVariables = sPageURL.split('&');
    	for (var i = 0; i < sURLVariables.length; i++)
    	{
    		var sParameterName = sURLVariables[i].split('=');
    		if (sParameterName[0] == sParam)
    		{
    			return sParameterName[1];
    		}
    	}
    }    
    
    //new click-handler for reply-links
    $(".quip-reply-link a").click(function(e) {
        e.preventDefault();
		
        //extract quip_parent from href
        var parent = getUrlParameter('quip_parent',$(this).attr("href"));		
		//set parent in the form
		$("input[name='parent']").val(parent);
		
		//scroll to form
		$('html, body').animate({
            scrollTop: $("#quip-add-comment-qcom").offset().top
        }, 500);
	});
});
</script>

```

---

<div class="post-metadata">

**Author:** ![wemyssweb](https://community.modx.com/user_avatar/community.modx.com/wemyssweb/32/903_2.png) [@wemyssweb](https://community.modx.com/u/wemyssweb)\
**Post date:** [November 2, 2020, 7:35pm UTC](https://community.modx.com/t/quip-how-to-have-a-reply-link-and-inline-form-for-threading/3256/3 "2020-11-02T19:35:57Z")

</div>

Interesting, but cannot get it working.  
Is this supposed to scroll the reply form 500px from the top?  
Will have a look at the PHP and JavaScript code.  
Do not know much about ext.js.

---

<div class="post-metadata">

**Author:** ![halftrainedharry](https://community.modx.com/user_avatar/community.modx.com/halftrainedharry/32/1063_2.png) [@halftrainedharry](https://community.modx.com/u/halftrainedharry)\
**Post date:** [November 2, 2020, 8:40pm UTC](https://community.modx.com/t/quip-how-to-have-a-reply-link-and-inline-form-for-threading/3256/4 "2020-11-02T20:40:49Z")

</div>

This example uses [jQuery](https://jquery.com/) not Ext.js.  
If you don’t already use jQuery than you have to download it or rewrite the code to use only plain javascript.

```auto
<script src="jquery-3.5.1.min.js"></script>

```

When you click on a “reply”-link, it scrolls to the form that is at the bottom of the page. (500 is the time in milliseconds it takes to finish the scroll-animation). This is just an example. The important part is to change the value of the “parent” field. A better solution is probably to change the CSS of the form to `position: fixed;` (like in this forum) and then show/hide it with `$("#quip-add-comment-qcom").slideUp();` respectively `$("#quip-add-comment-qcom").slideDown();` in jQuery.

---

<div class="post-metadata">

**Author:** ![wemyssweb](https://community.modx.com/user_avatar/community.modx.com/wemyssweb/32/903_2.png) [@wemyssweb](https://community.modx.com/u/wemyssweb)\
**Post date:** [November 3, 2020, 7:23pm UTC](https://community.modx.com/t/quip-how-to-have-a-reply-link-and-inline-form-for-threading/3256/5 "2020-11-03T19:23:19Z")

</div>

Got it working, was using slim jquery!  
Sorry it does not work, still opens form in a new page?  
An ideal solution would be to have jquery insert the form where the reply link is like in twitter!  
Is this working for you on Modx?

---

<div class="post-metadata">

**Author:** ![halftrainedharry](https://community.modx.com/user_avatar/community.modx.com/halftrainedharry/32/1063_2.png) [@halftrainedharry](https://community.modx.com/u/halftrainedharry)\
**Post date:** [November 4, 2020, 11:31am UTC](https://community.modx.com/t/quip-how-to-have-a-reply-link-and-inline-form-for-threading/3256/6 "2020-11-04T11:31:23Z")

</div>

> [@wemyssweb](#):
>
> An ideal solution would be to have jquery insert the form where the reply link is

You can achieve this, when you replace the code that scrolls to the form with this code:

```auto
//move form to position after reply link
$(this).parents(".quip-comment-text").after($("#quip-add-comment-qcom"));

```

> [@wemyssweb](#):
>
> Is this working for you on Modx?

Yes, it work on my installation. Are there any errors in the console of the developer tools in the browser?

---

<div class="post-metadata">

**Author:** ![wemyssweb](https://community.modx.com/user_avatar/community.modx.com/wemyssweb/32/903_2.png) [@wemyssweb](https://community.modx.com/u/wemyssweb)\
**Post date:** [November 4, 2020, 1:28pm UTC](https://community.modx.com/t/quip-how-to-have-a-reply-link-and-inline-form-for-threading/3256/7 "2020-11-04T13:28:20Z")

</div>

Will check when i get home.  
Do i need to remove the comment resource and change the snippet property?

---

<div class="post-metadata">

**Author:** ![halftrainedharry](https://community.modx.com/user_avatar/community.modx.com/halftrainedharry/32/1063_2.png) [@halftrainedharry](https://community.modx.com/u/halftrainedharry)\
**Post date:** [November 4, 2020, 2:09pm UTC](https://community.modx.com/t/quip-how-to-have-a-reply-link-and-inline-form-for-threading/3256/8 "2020-11-04T14:09:21Z")

</div>

No need to remove the “reply resource”. You have to keep the `&replyResourceId`-property or else the snippet call won’t create reply-links.

```auto
[[!Quip? &thread=`mythread` &replyResourceId=`123`]]
[[!QuipReply? &thread=`mythread`]]

```

Also, make sure to use the default templates for `&tplComment` and `&tplAddComment` so that the class/id-selectors in the code match the markup.

---

<div class="post-metadata">

**Author:** ![wemyssweb](https://community.modx.com/user_avatar/community.modx.com/wemyssweb/32/903_2.png) [@wemyssweb](https://community.modx.com/u/wemyssweb)\
**Post date:** [November 6, 2020, 8:35am UTC](https://community.modx.com/t/quip-how-to-have-a-reply-link-and-inline-form-for-threading/3256/9 "2020-11-06T08:35:34Z")

</div>

Was working then got this error in frontend?  
This thread has been closed from taking new comments.

---

<div class="post-metadata">

**Author:** ![halftrainedharry](https://community.modx.com/user_avatar/community.modx.com/halftrainedharry/32/1063_2.png) [@halftrainedharry](https://community.modx.com/u/halftrainedharry)\
**Post date:** [November 6, 2020, 8:46am UTC](https://community.modx.com/t/quip-how-to-have-a-reply-link-and-inline-form-for-threading/3256/10 "2020-11-06T08:46:21Z")

</div>

The snippet [QuipReply](https://docs.modx.com/current/en/extras/quip/quip.quipreply) has a property `&closeAfter` that defines the number of days at which the thread will automatically close after it was created. The default is 14 days. Set the property to 0 to leave the thread open indefinitely.

---

<div class="post-metadata">

**Author:** ![wemyssweb](https://community.modx.com/user_avatar/community.modx.com/wemyssweb/32/903_2.png) [@wemyssweb](https://community.modx.com/u/wemyssweb)\
**Post date:** [November 7, 2020, 12:59pm UTC](https://community.modx.com/t/quip-how-to-have-a-reply-link-and-inline-form-for-threading/3256/11 "2020-11-07T12:59:03Z")

</div>

Thanks so much for your help.  
I was having another issue with the reply links not showing.  
Checked all relevant code for errors.  
Went into quip comment back end and deleted threads.  
Then my reply links appeared.

---

<div class="post-metadata">

**Author:** ![system](https://community.modx.com/user_avatar/community.modx.com/system/32/2_2.png) [@system](https://community.modx.com/u/system)\
**Post date:** [November 9, 2020, 12:59pm UTC](https://community.modx.com/t/quip-how-to-have-a-reply-link-and-inline-form-for-threading/3256/12 "2020-11-09T12:59:09Z")

</div>

Closed on November 9, 2020, 12:59pm UTC

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.
