Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
in custom form, captcha added, Form submit via AJAX,
Issue reproduce step
step 1: form display captcha1+5=?
step 2: i entered "4"
step 3: system said, captchafailed, enter valid number
step 4: form displayed captcha1+5=?
step 5: i entered "6"
step 6:system still saying, captchafailed, enter valid number
Please let me know, actual issue.
my observation is, in screen behind, new captcha generated, but system unable to display newly generated captcha.
please suggest the best solution
module: captcha 7.x-1.3
function home_page_post_form($form, &$form_state) {
$form = array();
$form["wrapper"] = array(
"#markup" => "<div id='test-ajax'></div>"
);
$form['txt_title'] = array(
'#title' => t('Post title'),
"#required" => true,
'#type' => 'textfield',
);
$form['txt_desc'] = array(
'#title' => t('Post description'),
'#type' => 'textarea',
);
$form['captcha'] = array(
'#type' => 'captcha',
'#captcha_type' => 'captcha/Math',
'#tree'=>true,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
"#ajax" => array(
"callback" => "dr_search_test_form_callback",
"wrapper" => "test-ajax",
"effect" => "fade")
);
return $form;
}
Comment | File | Size | Author |
---|---|---|---|
drupal-capcha.PNG | 4.76 KB | ganeshfriends |
Comments
Comment #2
Chris Matthews CreditAttribution: Chris Matthews as a volunteer commentedComment #3
Anybody