-
- 84 Posts
Good morning,
I'm using Articles (v.1.6.3) on MODX Revolution 2.2.6-pl.
Everything is working fine so far.
When a user fills in a comment on the blog an error appears, but the top of the page is shown and not the comment-field with the error.
So the error is not visible for the user until he scrolls down again.
Any tips how I can change that?
Thanks in advance!
Joost
-
- 24,544 Posts
Probably the best way would be to write JavaScript code to pop up an alert and put the focus on the problem field without submitting the form.
-
- 84 Posts
Hi Bob,
thanks for your respons.
At the moment my knowledge of JavaScript is however too limited to make this work.
I was wondering if it is maybe possible to put something in the Articles code to change the behaviour in case a comment-field is not filled in.
When the comment is succesfully sent, it shows just below the comment-fields.
I prefer something like that. Just saw by accident that Mark Hamstra's blog is working that way.
-
- 24,544 Posts
I sent a Tweet to Mark. Hopefully, he'll chime in.
In your comment chunk (Article resource > Advanced > Display under Comments), make sure that your wrapper div (or in my case it's a list item), has an ID set like this:
<li id="[[+idprefix]][[+id]]">
That will give each comment an ID like qcom103, which can then be used as an anchor in the link. On my site I changed the idPrefix (not sure if Articles lets you change that) to "comments", so in my case the IDs are comments103 etc, but you can see that by appending #comments103 to the url, it immediately goes to the right comment:
https://www.markhamstra.com/modx-blog/2013/02/extjs-dream-nightmare-jquery/#comments376
When you have that ID set in your comment template it should work. The QuipReply snippet redirects the user back with the anchor in the link. (Make sure that if you changed the idPrefix like I did, that you also change it in the QuipReply snippet)
-
- 84 Posts
Guys,
thanks for the help!
I'm gonna try to make it work.
-
- 84 Posts
Mark,
I've tried several options, but none works.
I can give each comment an ID, but that only shows after the comment is displayed.
As far as I can see it is not generated when sending the form.
The error besides the form is shown, but because by default the top op the page is shown, nobody will ever see that error-message (see attachment).
Any further help is appreciated.
Joost
Can you share what did to resolve this? Right now none of my articles extra links work. I can only view the container summary page, the links to the actual articles or comments are not working.