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
Priyanka Reddy 74Priyanka Reddy 74 

onclick a button 2 debug logs are generating

Hi All,

I have created button which calls javascript method and from script passing arguments to apex:actionFunction. 

actionFunction invokes apex controller method.

once i click on button it generating 2 logs. 
User-added image
among this 2 logs only one log contains debug statement.

VF code:
 
<apex:actionFunction action="{!split}" name="methodOneInJavascript2" reRender="resultofjs"  >
            <apex:param name="selectedStringValues"   assignTo="{!selectedStringValues}"  value="" /> 
            <apex:param name="selectedDoubleValues"   assignTo="{!selectedDoubleValues}"  value="" />
            <apex:param name="selectedIntegerValues"  assignTo="{!selectedIntegerValues}"  value="" />
        </apex:actionFunction>



<script>
function test(){
        var list=' ';
        var list2=' ';
        var list3=' ';
        var i,j,k;
        for(i=1;i<={!stringsize};i++){
            if(document.getElementById(i).checked == true){
                list += document.getElementById(i).value + '#';
                
            }
        }
        for(j={!stringsize+1};j<={!doublesize};j++){
            if(document.getElementById(j).checked == true){
                list2 += document.getElementById(j).value + '#';
            }
        }
        for(k={!doublesize+1};k<={!integersize};k++){
            if(document.getElementById(k).checked == true){
                list3 += document.getElementById(k).value + '#';
            }
        }
        methodOneInJavascript2(list,list2,list3);       
    }
</script

Apex: Controller
public void test(){
        system.debug('selectedStringValues'+selectedStringValues);
    }


Can someone please help me why it is calling 2 times.
If you want to debug logs do let me know I'll share if required.

Thank you.
 
Best Answer chosen by Priyanka Reddy 74
Daniel AhlDaniel Ahl

Hello, 

Have you checked the content of the logs?

They are different sizes, meaning they should have different content in them
My guess would be that it could be because of the reRender="resultofjs" that might trigger another apex-method?

Or there is something else triggered by your {!split} method?

All Answers

Daniel AhlDaniel Ahl

Hello, 

Have you checked the content of the logs?

They are different sizes, meaning they should have different content in them
My guess would be that it could be because of the reRender="resultofjs" that might trigger another apex-method?

Or there is something else triggered by your {!split} method?

This was selected as the best answer
ShirishaShirisha (Salesforce Developers) 
Hi Priyanka,

Greetings!

Please be informed that there is no limitation on the debug logs when the process invoked by one apex class only.

It can create multiple logs which will have the code execution.

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
Priyanka Reddy 74Priyanka Reddy 74
Hi Daniel and Shirisha,

Thank you. I was able fix issue it was because of rerender.

Thanks,
Priyanaka