Hey BC community,
Have any of you had a client request that the comment fields be mandatory? I know they're subject to content approval but it has been requested.
Any help would be appreciated,
The comments form uses the same validation as any other form. You just need to add the if statement for the correct field you want to be required.
So for the full name input text field you would add this:
Then for the email address:
Add these on top of the captcha validation, and keep it just like any other form. You can clean up the validation code with http://jsbeautifier.org/
Here is an example:
Hope this helps,
Chad Smith | http://bcgurus.com/Business-Catalyst-Templates for only $7
Hi Chad, please assuming it is the feedback multiline field of the comment form I want to validate. How would the validation go? I have tried using the full name syntax you showed above, but it doesn't validate. Please help. Regards
Not sure why it did not work for you, it is the same code as the fullname field. I've tested this on my sandbox site and this should be the code you need to add to your validation:
if (theForm.Feedback) why += isEmpty(theForm.Feedback.value, "feedback");
I've placed this under the email validation. You can change the "feedback" to say what you want, not when the user doesn't add any feedback the validation pop up says "Please enter feedback".
If this still does not work please post a link or your code and we can go from there. But I hope this works for you =0).
Chad Smith - BC Gurus