• tracy berge
  • NEWBIE
  • 0 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi All,
In my below code, I have to call tow javascript functions "amtValidation() and clickMe()" inside javascript "nameValidation". These functions should be called based on the button click. when "send" button is clicked it has to call amtValidation(), and when "click Me" is clicked it has to call clickMe(). Please help.
============
<apex:page controller="Bookings" id="page">
<script>
    
    function nameValidation(){
    
      var n = document.getElementById('{!$Component.page.form.pb.pbs.name}');
        alert(n.value);
        if(n.value == "")
        {
            alert("Name is mandatory");
            return false;
        }
        else{
        alert("enter name else");
         amtValidation();
         clickMe();
        }
        }
    function amtValidation(){
        //process here
    }
     function clickMe(){
        //process here
    }
    
    <apex:form id="form">
  <apex:actionFunction action="{!send}" name="send" reRender="pb" />
  <apex:actionFunction action="{!clickme}" name="clickme" reRender="pb"/>
  <apex:pageBlock title="Vendor Registration Form" id="pb">
  <apex:pageBlockSection columns="2" id="pbs">
  Name :<apex:inputText value="{!vcperson}" id="name"/>
  
   
  </apex:pageBlockSection>
  <apex:outputPanel id="op">
  <apex:commandButton value="Send" id="email" action="{!send}" onclick="return nameValidation();return amtValidation()"/>
  <apex:commandButton value="Click Me" id="pdf" action="{!clickme}" onclick="return nameValidation();return clickMe()"/>
  </apex:outputPanel>
  
  
  </apex:pageBlock>
</apex:form>
</apex:page>
  • May 18, 2021
  • Like
  • 0