(Sorry for the bad title in the previous bug report)

Here is a form which is configured to use image challange. Still no "generate a new captcha" is missing.
The form is inside of a block which is the only difference I can spot.

<form action="/en/search/node" accept-charset="UTF-8" method="post" id="search-form"
class="search-form">
<div>
    <div class="form-item" id="edit-keys-wrapper">
        <label for="edit-keys">
            Enter your keywords:
        </label>
        <div class="container-inline">
            <div class="form-item" id="edit-keys-wrapper">
                <input type="text" maxlength="255" name="keys" id="edit-keys" size="40" value=""
                    class="form-text" data-cip-id="edit-keys">
            </div>
            <div class="captcha">
                <input type="hidden" name="captcha_sid" id="edit-captcha-sid" value="3529">
                <input type="hidden" name="captcha_token" id="edit-captcha-token" value="32aa567ce5a23861e98955901db5fc6f">
                <img src="/en/image_captcha/3529/1377590605" class="captcha_image" id="captcha_image_3529"
                    alt="Image CAPTCHA" title="Image CAPTCHA"><div class="form-item" id="edit-captcha-response-wrapper">
                        <label for="edit-captcha-response">
                            What code is in the image?: <span class="form-required" title="This field is required.">
                                *</span></label>
                        <input type="text" maxlength="128" name="captcha_response" id="edit-captcha-response"
                            size="15" value="" class="form-text required" autocomplete="off" data-cip-id="edit-captcha-response">
                        <div class="description">
                            Enter the characters shown in the image.</div>
                    </div>
            </div>
            <input type="submit" name="op" id="edit-submit" value="Search" class="form-submit">
        </div>
    </div>
    <input type="hidden" name="form_build_id" id="form-9bfb2cc468f8b4c40b372fe4b0aeec7f"
        value="form-9bfb2cc468f8b4c40b372fe4b0aeec7f">
    <input type="hidden" name="form_id" id="edit-search-form" value="search_form">
</div>
</form>

Comments

ddrozdik’s picture

Please specify which version of drupal and captcha do you use.

maxilein’s picture

Sorry for not mentioning them earlier.
Drupal 6.28
CAPTCHA 6.x-2.5
Image CAPTCHA 6.x-2.5

Delivron_dg’s picture

I've encountered the same problem. After debugging the module image_captcha_refresh.module, I found out that adding refresh-link depended on the presence of the element $form['captcha'], but blocks didn't have this element. On the other hand they had $form['wrapper']['captcha'] element that also turned out suitable for adding that after-build behavior . I don't know if it's a correct solution, but it works. Here it is:

Find image_captcha_refresh_form_alter function in the modue image_captcha_refresh.module, and replace this code:

  if (isset($form['captcha'])) {
    $form['captcha']['#after_build'][] = 'image_captcha_refresh_after_build_process';
  }

with the following one:

  if (isset($form['captcha'])) {
    $form['captcha']['#after_build'][] = 'image_captcha_refresh_after_build_process';
  }
  else
  {
    if (isset ($form['wrapper']) && isset($form['wrapper']['captcha']))
      $form['wrapper']['captcha']['#after_build'][] = 'image_captcha_refresh_after_build_process';  
  }
ddrozdik’s picture

Status: Active » Closed (won't fix)