One of the most requested features for CComment has always been the creation of custom fields for the comment form. Traditionaly it has been always possible to customize the form by using a template override and a custom plugin to act on the submitted information. However this has one drawback - it requires a developer to do the modifications. Starting with CComment 4.3 you are now able to create custom fields and request people to not only submit a comment, but additional information. You can now create simple fields such as text, select or checkbox using a simple graphical interface.
You can access this feature by clicking on the custom fields toolbar link.
The parameters for each custom field are:
The display title of the field. If you want to translate the title, please use a language constant.
The internal name of the field. It should consist of only lowercase, unaccented letters (a-z) and numbers (0-9).
- When to Show
Fields can be shown for all components or for specific components only
If you set the option above to
Specific componentsthis defines for which components the field will be displayed. When the
When to showoption is set to
All componentsthis will be ignored
- Field Type
Chose the type of the field. The available options are:
Checkbox. Creates a single tick box.
Select list. Creates a drop-down selection field. Ideal for selecting between short descriptions or a lengthy list. You can define the available options in the Options field below.
Text box. Creates a simple text entry box.
Url. Creates a field for entering an url address
Its function depends on the field type:
Text. Anything you type in here will be shown as a placeholder (gray text which disappears when you start typing) inside the box.
Checkbox. You can enter the following options:
translate=true value_checked=I WAS CHECKED
value_checkedvariable will be used to display the value of the checked box. Instead of showing the default value, which is 1, we will show whatever you have specified in
translatevariable can be either
false. This would define whether the specified value in
value_checkedshould be translated through JText. This would allow you to have multilingual version of the field.
Everything else: For all other field types this is how you define options and their labels. The format is VALUE=LABEL, on pair per line. For example:
1=One 10=Ten 100=A hundred 1000=A thousand
With the example above, a drop=down list would show you the options One, Ten, A hundred and A thousand. The value stored, depending on your selection, would be 1, 10, 100 or 1000.
To make it clear: Each line defines one option to be shown to the user. Anything to the left of the equals sign is saved in the database and is made available to you when you display the contents of the field. Anything to the right of the equals sign is what your client sees in the front-end new ticket page.
- Default value
The default value the field is set to. It depends on the field type:
Text. The contents of the box.
Checkbox. The value that will be stored in the database.
Everything else. Enter the value (left-hand part) of an option you defined in the Options above.
- Allow Empty
If checked the custom field is allowed to be left empty / unchecked by your client. If it's not checked (default), the system will not allow your subscriber to submit the new comment unless he fills in / checks the field.