", "answerCount": 3, "upvoteCount": 0, "datePublished": "2017-06-08T20:37:10.000Z", "author": { "@type": "Person", "name": "Kimberly Dy", "url": "https://trailblazers.salesforce.com/profileView?u=0053A00000CyuR4QAJ", "affiliation": { "@type": "Organization", "name": "LogMeIn" } }, "suggestedAnswer": [ { "@type": "Answer", "text": "Hi Kim, You need to Call the Javascript function from the VF page u have. create any button and call the JS Function in order to validate ur VF page. Thanks, Ram", "upvoteCount": 0, "url": "https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T408kSAB", "datePublished": "2017-10-25T13:52:30.000Z", "author": { "@type": "Person", "name": "Sitarama Murthy S", "url": "https://trailblazers.salesforce.com/profileView?u=0053000000CWTf0AAH", "affiliation": { "@type": "Organization", "name": "Arrow Electronics India Pvt Ltd" } } } ] } } Skip to main content
Kimberly Dy (LogMeIn) a posé une question dans #Visualforce
Hello,

Need help on javascript validation on a visualforce page. The VF page itself is using the standard controller for Opportunity. I'm new to vf page and js, so I'm unsure what I'm missing. Any feedback is appreciated. 

<script>

    function validateType(){

        var valType = document.getElementById'{!$Component.form.pageBlock2.initialFollowType.outputType.Type}').value;

if(valType.value=="Email")

            {

                alert("If Initial Follow Up Type = Phone or Email, Follow Up Date is Required, Follow Up Time of Day is Required, and Appointment Time should be blank");

                return false;

            }else

            {

              if(valType =="Phone"&& valDate ==NULL && valTimeofDay ==NULL && valTime !=NULL)

              {

                    alert("If Initial Follow Up Type = Phone or Email, Follow Up Date is Required, Follow Up Time of Day is Required, and Appointment Time should be blank");

                    return false;

              }

             }return true;        

                            

     </script>
3 réponses
0/9000