How to add a TOS checkbox to submit forms

From JReviews Documentation
Jump to: navigation, search

To add a Terms of Service checkbox to the submit form, you will need to create a new custom field in the Fields Manager:

Tos.png

Assign the field to one of the field groups that is used in all your listings.

In the Description textarea you can add a link to a Terms of Service article. If you don't have it, create it in Joomla Article Manager in "Uncategorized" category. It is also recommended to create an article menu item for it so that it gets a nice URL which you can include in this field's description.

The Required option must be set to Yes so that users can't submit a listing without checking the checkbox.

In View/Search Access deselect all user groups so that this field doesn't appear in the field output or searches.

After you save the field, click the Field Options button:

Tos2.png

Add a single field option that users will need to check:

Tos3.png

The custom field will look like this on the submit form:

Tos4.png

The TOS field will be included together with other custom fields by default. If you want it to display at the bottom of the submit form, this will require code customizations.

Before making any code customizations, read about JReviews Code Overrides and setup a custom theme. You will need to copy this theme file into your custom theme: /com_jreviews/jreviews/views/themes/default/listings/create_form.thtml

and add this code at the very bottom of the file:

<script type="text/javascript">
var $tos = jQuery('div.jrFieldDiv.jrTermsofservice').detach();
$tos.insertBefore('.jr-buttons');
</script>


The field will then be displayed above the Submit/Cancel buttons:

Tos5.png