1

How to add the Terms and Conditions to custom form?
i have made a module and willing to add a "read me / terms and conditions " type of thing to my form .
Whole code can be seen here , just dont wanted to write it again .
Custom module error, does'nt show on the page

Please suggest.

1
  • @kantu checkbox that hides a textarea with states property is what you mean? But if check box is ticked then that displays the text area with conditions text but then how to accept these conditions . With the checkbox we can toggle the textarea but which checkbox will refer to acceptance or agreeing to terms and conditions Oct 9 '12 at 10:12
2

You can just add another element to the form like so:

$form['terms'] = array(
  '#type' => 'checkbox',
  '#title' => t('Terms & Conditions'),
  '#prefix' => "<p>Your terms go here</p>",
  '#required' => TRUE,
);

That will just stick the text before the checkbox, and then use CSS to position it however you want.

You might also want to put a validate hook in there and remove the #required attribute so you can write your own text in the form_set_error.

1
  • 1
    Thanks for suggestions,but through little research i came to find out that we have a module called as Legal for adding terms and condtions drupal.org/project/legal Oct 19 '12 at 9:16
2

Use the Legal module

Displays your Terms & Conditions to users who want to register, and requires that they accept the T&C before their registration is accepted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.