You need to sign in to do that
Don't have an account?
ShaikA
How to call a method many times by using Javascript
HI,
I have a senario to call a method many times to navigate PDF page many times, please help me how can achieve this.
Vf Page:
<apex:page controller="PDFController" >
<script>
function myJavascriptFunc()
{ alert('Entered Javascript') ;
for(integer i=0; i<4; i++){
alert('Entered Javascript') ;
CallApexMethod(i) ;
}
}
</script>
<apex:form >
<apex:actionFunction name="CallApexMethod" action="{!PDFGenerator}" rerender="mpb" />
<apex:commandButton onclick="myJavascriptFunc()" value="PDF Generator"/>
</apex:form>
</apex:page>
Class:
public with sharing class PDFController {
public PageReference PDFGenerator()
{
PageReference pdf = Page.selectedCandidatesPDFPage;
pdf.setredirect(true);
return pdf;
}
}
Regards,
Anand
I have a senario to call a method many times to navigate PDF page many times, please help me how can achieve this.
Vf Page:
<apex:page controller="PDFController" >
<script>
function myJavascriptFunc()
{ alert('Entered Javascript') ;
for(integer i=0; i<4; i++){
alert('Entered Javascript') ;
CallApexMethod(i) ;
}
}
</script>
<apex:form >
<apex:actionFunction name="CallApexMethod" action="{!PDFGenerator}" rerender="mpb" />
<apex:commandButton onclick="myJavascriptFunc()" value="PDF Generator"/>
</apex:form>
</apex:page>
Class:
public with sharing class PDFController {
public PageReference PDFGenerator()
{
PageReference pdf = Page.selectedCandidatesPDFPage;
pdf.setredirect(true);
return pdf;
}
}
Regards,
Anand
You could do this by adding an actionstatus to the actionfunction, and specifying an oncomplete handler to be executed when the request has been handled by the server. This oncomplete handler can call a JavaScript function which updates the counter, and executes the action function again if necessary.