3

For example, this site (Drupal Answers) has this feature-- if you input too little text in the text box, the interface prompts you to write more. Is there a module to do this? I tried various searches but I haven't been able to find anything.

3 Answers 3

5

You should be able to just use the Field validation module to set a minimum length on the body field.

This module adds an extra tab to each field instance, allowing you to specify validation rules for your field instances.

By using the hooks provided by this module, you can also define your own validation rules in your own modules.

2

If you are comfortable with code, the basic approach is to hook_form_alter the node_form and add an additional #validate to the field. Just note that allowing markup in the field will count towards charaters. You may want to base your count off of what strip_tags returns, rather than the actual field value.

2

In addition you could implement an 'n characters to go' counter for minimum length (a la stackoverflow) with javascript/jquery which counts before submission.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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