Monday, March 11, 2013

Displaying the alert window in Visualforce Page

Visualforce Page:

<apex:page id="page" >
<script>
    function check(){
        alert('Hi');
        var txt = document.getElementById('page:form:pb:txt').value;
        alert(txt);
        if(txt == ''){
        alert('Please enter name');
                        }
        return true;
                            }
 
    function dbclick(){
        alert('Double Clciked');
                              }
 
    function moved(){
        alert('Mouse pointer is moved');
                              }
</script>
  <apex:form id="form" >
      <apex:pageBlock id="pb" >
          Name :<apex:inputText id="txt" ondblclick="dbclick()" onblur="moved()" />
          Email:<apex:inputText id="txt1" />
          Address:<apex:inputTextArea id="txtArea" />
          <apex:commandButton value="Save" onclick="return check()" />
      </apex:pageBlock>
  </apex:form>
</apex:page>

No comments:

Post a Comment