It would make styling the Captcha fieldset components much simpler if there was a CSS class or id assigned to the surrounding fieldset. I have created a patch that assigns a class to the fieldset, just in case somebody has more than one captcha on a page.

CommentFileSizeAuthor
#5 captcha_class_2.patch770 bytessoxofaan
captcha_class.patch388 bytesdavemybes

Comments

robloach’s picture

Status: Active » Fixed

Nice... Think should it be applied to the actual Captcha form too?

davemybes’s picture

Thanks! I don't think its necessary as the fieldset wraps everything. Using that CSS declaration we can target everything inside.

robloach’s picture

Yes, but what if you're not using the fieldset? What if you're CAPTCHA description is an empty string, so that the CAPTCHA API doesn't display the form in a fieldset. Do you think we should apply the class to the element?

davemybes’s picture

Ah, I see what you mean now. Sorry, I was being a bit dense.

Sure, it would make more sense to do it that way then. Maybe something along the lines of this:

    // Add the form elements of the generated captcha challenge to the form
       $form['captcha'] = array_merge($form['captcha'], $captcha['form']);
+    $form['captcha']['#prefix'] = '<div class="captcha-form">';
+    $form['captcha']['#suffix'] = '</div>';

This would then also wrap any description fieldset if one were present, so no need for my previous patch, I guess.

soxofaan’s picture

Status: Fixed » Needs review
StatusFileSize
new770 bytes
robloach’s picture

Status: Needs review » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.