当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Popup for form fields in zend application

问题描述:

I have created a Zend based php application.

I am looking for a simple way to create a popup or hoover-over help that I can use to to provide user help for the fields that the user should enter.

I guess I need javascript, and for the Zend form elements some decorator. But I have not been able to figure out how it should work. Maybe I need some CSS as well?

Does anyone have an example.

kind regards,

Vincent

网友答案:

you may use the jquery plugin for validation, which would prevent the form from submitting until first level checks have been passed. You find further information on the documentation page of jquery. But never trust those checks. You should always validate user input in the backend

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

or you use this, based on 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>
网友答案:

I think you are looking for a tool tip for your controls.

Check this out jQuery Tooltip Plugin Demo

or this jQuery tools: tool tip

分享给朋友:
您可能感兴趣的文章:
随机阅读: