We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21122
    • 153 Posts
    Hi there,

    I’m using Jot on my site for users to leave comments. When I use the basic [!Jot? !] call, the form appears. However, I’d like to add in some custom fields. When I use the custom fields parameter like ’&customfields=`name,email` nothing new appears. I’ve also tried to put a captcha on my form and this doesn’t work either.

    I don’t have Phx installed (I’ve read that this can cause problems) so am at a loss as to why I can’t get this to work.

    Cheers
    • Adding custom fields won’t work for existing items, since there are no entries in the custom table for them.

      There are a number of reasons why captcha won’t work that may or may not actually have anything to do with Jot.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 21122
        • 153 Posts
        Hi Susan,

        I was following the tutorial here - http://codingpad.maryspad.com/2009/07/23/building-a-website-with-modx-for-newbies-part-11-adding-comments-with-jot/ and it seems that they just added the custom fields parameter, gave it the titles and voila!

        What do you mean about existing items? I’m not really bothered about the captcha not working, but I would really like to get the custom fields sorted.

        Thanks
        • If you have some comments already, then add custom fields, the already existing comments won’t have entries in the new custom table.

          The way the custom table works is that when a comment is created, an entry is made in the custom table consisting of three fields: the comment ID, the name of the custom field and the value of the custom field.

          When a comment is edited, a WHERE clause is used to update the custom table for that comment by its ID. But if the comment was created initially before custom fields were implemented, the comment has no entry in the custom table to be updated.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 21122
            • 153 Posts
            Ok, I understand what you mean. However, this site is still in development, and therefore, there are no comments there yet (I’ve tested the form and it works, but since deleted the comments).

            I’m currently using the call
            [!Jot? &customfields=`name,email` &validate=`name:Please enter your name,email:Please enter a valid e-mail address.:email` !]


            But this doesn’t display anything other than a form with the default ’Subject’ and ’Comment’ inputs.

            What am I doing wrong?!
            • Ah! You have to customize your form yourself. The default form has these fields; you can find it at assets/snippets/jot/templates/chunk.form.inc.html. The relevant section looks like this:
              	[+form.guest:is=`1`:then=`
              		<label for="name[+jot.id+]">Name:<br />
              		<input tabindex="[+jot.seed:math=`?+1`+]" name="name" type="text" size="40" value="[+form.field.custom.name:esc+]" id="name[+jot.id+]" />
              		</label>
              		<label for="email[+jot.id+]">Email:<br />
              		<input tabindex="[+jot.seed:math=`?+2`+]" name="email" type="text" size="40" value="[+form.field.custom.email:esc+]" id="email[+jot.id+]"/>
              		</label>
              	`:strip+]
              

              Notice the placeholder [+form.field.custom.name:esc+]; the custom part gets added in there if it’s for a custom field.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 21122
                • 153 Posts
                Thanks for that Susan, it looks like I’ve finally explained what I’m trying to do well enough!

                When you say I need to customize the form myself, which form do I need to customize? chunk.form.inc.html? I’ve found the section with the ’Name’ and ’e-mail’ fields in, but I don’t know what to do to make them appear?!

                Sorry for the silly question, and thanks for your help once again.
                  • 21122
                  • 153 Posts
                  Phew, ok. I’ve managed this now. Just removed the :Strip bit before the fields.

                  Thanks anyway Susan.