在zend应用程序中弹出表单域

时间:2012-04-07 11:59:36

标签: javascript zend-framework popup element

我创建了一个基于Zend的php应用程序。

我正在寻找一种简单的方法来创建弹出窗口或hoover-over帮助,我可以使用它来为用户应输入的字段提供用户帮助。

我想我需要javascript,并且对于Zend表单元素一些装饰器。但我无法弄清楚它应该如何运作。也许我也需要一些CSS?

有没有人有例子。

亲切的问候, 文森特

2 个答案:

答案 0 :(得分:0)

您可以使用jquery插件进行验证,这会阻止表单在第一级检查通过之前提交。您可以在jquery的文档页面上找到更多信息。但绝不相信那些支票。您应始终在后端验证用户输入

http://docs.jquery.com/Plugins/Validation

或者你使用它,基于jquery

<!DOCTYPE html>
<html>
<head>
  <title>Form Info</title>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

  <script type="text/javascript">
    $(document).ready(function(){
      $(':input.form-input').live('focus', function(){ //get input field
      $(this)
      .closest("div") //get up to div element
      .find(".form-info") //and search for corresponding form-info class to that input field
      .show(); //show it
      }).live('blur', function(){
      //once you leave the input field you might to some things

      //...

      //or just remove the element
      $(this)
      .closest("div") //get up to div element
      .find(".form-info") //and search for corresponding form-info class to that input field
      .hide(); //hide it
      });
    });
  </script>

</head>
<body>

  <div>
      <input type="text" name="blub" value="" class="form-input" />
      <span class="form-info" style="display:none;">my info to the customer</span>
  </div>

</body>
</html>

答案 1 :(得分:0)

我认为您正在为控件寻找工具提示。

查看jQuery Tooltip Plugin Demo

或此jQuery tools: tool tip

相关问题