-
- 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.
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.
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.
-
- 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.
-
- 153 Posts
Phew, ok. I’ve managed this now. Just removed the :Strip bit before the fields.
Thanks anyway Susan.