• Eyal Hutter 1
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hey,

I have a visualforce component that is calling the remote action "insertAllRecords" in the controller by clicking a button and as I seen there is a strange behaviour:
 
Sometimes when I click the button the remote action is doing all the function code and returning to the handler but sometime it is just doing the code without returning to the handler. I saw on the debug log that all the code worked successfully without errors, also checked the chrome browser console and ther are no errors there. I have a jquery.noconflict() call and I tried to isolate the call to the remote action from the rest of the visualforce page and the behaviour hasn't changed.

at the handler there should be redirecting to a different page but that is not happening all the time and the console.log too that I have.

It looks like a conflict or a bug in salesforce but it is not showing any error.

Here is the code of the javascript:

function ajaxPost(listToInsert) {
                var campaignId = '{!campaignId}';
                var objectType = '{!typeObject}';
                var allIdsString = listToInsert;
                allIdsString = allIdsString.substring(1, allIdsString.length-1);
                var allIdsArray = allIdsString.split(",");
                console.log('campaignId: ' + campaignId);
                console.log('allIds: '  + allIdsArray);
                console.log('objectType: ' + objectType);
                vfTableGenerate.insertAllRecords(campaignId, allIdsArray, objectType,
                function(result, event){
                    console.log('111');
                    console.log(event.status);
                    if (event.status) {
                       top.window.location = result;
                    }        
                  
                });
            }

the visualforce button:

<apex:commandButton value="Add To Campaign Members" onclick="ajaxPost('{!recordToInsertList}');"/>


Any help will be great!
Hey,

I have a visualforce component that is calling the remote action "insertAllRecords" in the controller by clicking a button and as I seen there is a strange behaviour:
 
Sometimes when I click the button the remote action is doing all the function code and returning to the handler but sometime it is just doing the code without returning to the handler. I saw on the debug log that all the code worked successfully without errors, also checked the chrome browser console and ther are no errors there. I have a jquery.noconflict() call and I tried to isolate the call to the remote action from the rest of the visualforce page and the behaviour hasn't changed.

at the handler there should be redirecting to a different page but that is not happening all the time and the console.log too that I have.

It looks like a conflict or a bug in salesforce but it is not showing any error.

Here is the code of the javascript:

function ajaxPost(listToInsert) {
                var campaignId = '{!campaignId}';
                var objectType = '{!typeObject}';
                var allIdsString = listToInsert;
                allIdsString = allIdsString.substring(1, allIdsString.length-1);
                var allIdsArray = allIdsString.split(",");
                console.log('campaignId: ' + campaignId);
                console.log('allIds: '  + allIdsArray);
                console.log('objectType: ' + objectType);
                vfTableGenerate.insertAllRecords(campaignId, allIdsArray, objectType,
                function(result, event){
                    console.log('111');
                    console.log(event.status);
                    if (event.status) {
                       top.window.location = result;
                    }        
                  
                });
            }

the visualforce button:

<apex:commandButton value="Add To Campaign Members" onclick="ajaxPost('{!recordToInsertList}');"/>


Any help will be great!