function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
rcherrcher 

Java script function not executing from a visualforce page

Hi,

I have a javascript function inside a visualforce page, the function is not getting executed on click of a button Let me know what the issue could be.

<apex:page standardController="Quote"> <style type="text/css"> .buttonDiv { padding-left: 115px; /*attempts to indent the button to better align within the standard page layout*/ } </style> <div class="buttonDiv"> <input class="btn" name="demo_button" onclick="Quote_To_CW()" title="Quote To CW" type="button"/> </div> <script src="/soap/ajax/33.0/connection.js"></script> <script> function Quote_To_CW(){ var sync = '{!Quote.IsSyncing }' var conversion = '{!Quote.Conversion_Status__c}' if( sync == false) { alert("Please sync your quote before continuing"); } else if( conversion == 'Sent') { alert("Your Quote has already been sent to CW"); } else { var r = confirm("Note that you can only send Quote to CW one time. Are you sure you want to send?"); } if(r==true) { var quoteID = '{!Quote.Id}' postParams = {} postParams.url = 'https://servicesuat.com:10000/QuoteToCW/' + quoteID postParams.method = 'GET' postParams.requestHeaders = {} postParams.requestData = '' postParams.requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded' //or another mime-type postParams.requestHeaders['Content-Length'] = postParams.requestData.length //required for POST postParams.onSuccess = processSuccess postParams.onError = processError sforce.connection.remoteFunction(postParams) function processSuccess(message) { // do something with results¨ alert("Quote has been synced to CW, don't click the Quote>CW Button Again. This page will now redirect"); ///window.location.href= "{'/006/o'}"; } function processError(message) { // do something with the error alert('error'); } } } </script> </apex:page>
vigneshwar kothavigneshwar kotha
Hi,

<apex:page standardController="quote__c">
<style type="text/css"> https://servicesuat.com:10000/QuoteToCW/
.buttonDiv { padding-left: 115px; /*attempts to indent the button to better align within the standard page layout*/ }
 </style>Quote__c
 <div class="buttonDiv"> 
 <input class="btn" name="demo_button" onclick="Quote_To_CW()" title="Quote To CW" type="button" value="submit"/> 
 </div> 
 <script src="/soap/ajax/33.0/connection.js"></script> 
 <script> 
 function Quote_To_CW()
 {
    var sync = '{!quote__c.IsSyncing__c }' 
    var coniiiversion = '{!quote__c.Conversion_Status__c}'
    alert('h');
    if( sync == 'false') 
        {
        alert("Please sync your quote before continuing");
        } 
        else
            if( conversion == 'Sent') 
            {
            alert("Your Quote has already been sent to CW"); 
            } 
            else 
                {
                  var r = confirm("Note that you can only send Quote to CW one time. Are you sure you want to send?"); 
                 } 
                 if(r=='true') 
                    {
                    
                   var quoteID = '{!quote__c.Id}' 
                    postParams = {} ;
                    postParams.url = 'https://servicesuat.com:10000/QuoteToCW/' + quoteID 
                    postParams.method = 'GET' 
                    postParams.requestHeaders = {} ;
                    postParams.requestData = '' 
                    postParams.requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded' 
                    postParams.requestHeaders['Content-Length'] = 'postParams.requestData.length' 
                    postParams.onError = 'processError sforce.connection.remoteFunction(postParams)'
                      function processError(message) {
                     // do something with the error 
                     alert('error'); 
                   function processSuccess(message)
                     { 
                     // do something with results
                      alert("Quote has been synced to CW, don't click the Quote>CW Button Again. This page will now redirect");
                       ///window.location.href= "{'/006/o'}";
                        }
                    
                     } 
                   
                    }
 } 
                    </script>

 </apex:page>