Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/371.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
Javascript 当我使用Happy.js提交表单时,如何获得显示的消息?_Javascript_Jquery_Forms - Fatal编程技术网

Javascript 当我使用Happy.js提交表单时,如何获得显示的消息?

Javascript 当我使用Happy.js提交表单时,如何获得显示的消息?,javascript,jquery,forms,Javascript,Jquery,Forms,我试图在不愉快函数中包含一个条件;当表单处理时,我没有收到表示成功的消息!这是我的密码 var dd= $.noConflict(); dd(document).ready(function () { dd('.success').hide(); dd('#frmContact').isHappy({ fields: { // reference the field you're talking about, pr

我试图在不愉快函数中包含一个条件;当表单处理时,我没有收到表示成功的消息!这是我的密码

var dd= $.noConflict();

  dd(document).ready(function () {
    dd('.success').hide();
        dd('#frmContact').isHappy({
            fields: {
              // reference the field you're talking about, probably by `id`
              // but you could certainly do $('[name=name]') as well.
              '#yourName': {
                required: true,
                message: 'Might we inquire your name'
              },
              '#email': {
                required: true,
                message: 'How are we to reach you sans email??',
                test: happy.email // this can be *any* function that returns true or false
              },
              '#comments': {
                required: true,
                message: 'Please leave a message!',
              }
          },
          unHappy: function () {
            var yourName = dd('#yourName').val();
            var email = dd('#email').val();
            var comments = dd('#comments').val();
                if (yourName && email && comments == true){
                    dd('.success').show();
                            return;

            } 
        },
      });
  });

从插件源代码来看,它似乎不支持任何ajax提交,所以将使用浏览器默认流程提交。javascript无法在出现这种情况时显示消息…将加载服务器脚本重定向页面感谢您的响应。我想我将不得不在isHappy范围之外编写函数,但这条路径不会导致我分别重新验证所有内容,这会破坏使用isHappy的目的吗?最好只是将验证插件切换到一个更健壮的插件。谢谢你,查理!对于其他遇到这个问题的人。签出看起来有很多文档!