Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 使用reCaptcha、Lightbox和Drupal';让我们一起形成API_Jquery_Drupal_Lightbox_Recaptcha_Drupal Fapi - Fatal编程技术网

Jquery 使用reCaptcha、Lightbox和Drupal';让我们一起形成API

Jquery 使用reCaptcha、Lightbox和Drupal';让我们一起形成API,jquery,drupal,lightbox,recaptcha,drupal-fapi,Jquery,Drupal,Lightbox,Recaptcha,Drupal Fapi,我一直在涉猎将Drupal表单放入Lightbox2 lightbox的问题 可能是错误的,我在提交表单之前使用javascript进行了所有验证(我无法让正常的验证返回lightbox中的表单) 无论如何,我正在使用: $form['#attributes']['onsubmit'] = 'return Drupal.mymodule.validateMailForm();'; 而且效果很好 接下来是ReCaptcha测试 if (validation == 'failed') {

我一直在涉猎将Drupal表单放入Lightbox2 lightbox的问题

可能是错误的,我在提交表单之前使用javascript进行了所有验证(我无法让正常的验证返回lightbox中的表单)

无论如何,我正在使用:

  $form['#attributes']['onsubmit'] = 'return Drupal.mymodule.validateMailForm();';
而且效果很好

接下来是ReCaptcha测试

if (validation == 'failed') {
  return false;
}
else { 
  return Drupal.mymodule.validateCaptcha();
}
当我最终让recaptcha停止提交表单而不管recaptcha结果如何时(我将函数替换为“return false”),我在validateCaption()函数中发现了这一点:

challengeField = $("input#recaptcha_challenge_field").val();
responseField = $("input#recaptcha_response_field").val();
console.log(challengeField);
console.log(responseField);
这两个变量都是“未定义的”。嗯

因此,有两个较小的问题(“为什么jquery不提取值?”和“onsubmit属性能否说服submit函数在执行其业务时等待?”)和一个较大的问题:

有人能将Drupal表单、lightbox和Recaptcha组合起来吗

编辑: 问题的第二部分——jquery没有提取值——是因为我在lightbox中使用了一个iframe(我无法让它保持其他状态)。将上述选择替换为:

challengeField = $('#iframeID').contents().find('input#recaptcha_challenge_field').val();
他在那里耍了花招


如果我能进一步破解这个问题,我会向您报告…

如果您使用jQuery获取捕获值,那么我假设您需要jQuery来处理提交事件,如下所示:

$("form#attributes").submit(function () { ... });
我不能100%肯定我的上述假设。有人想详细说明一下吗