• rahma bhb
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Hi,
I am calling a method saveData from my js controller when all the fields of my form are filled :
$("#myForm").validate({
            rules: {
                title: {required: true},
                firstname: {required: true},
                lastname: {required: true},
            },
            messages: {
                title:  "Please type and select a title",
                firstname: "Please enter the client first name",
                lastname: "Please enter the clients last name",
            },   
            tooltip_options:{
                '_all_': {placement: 'top'},
            },
            focusInvalid: false,
            submitHandler: function() {
                if($('#confirmation').prop("checked") == false ){
                    helper.showErrorMessage();
                }else {
                    helper.saveData(component);
                }
            }
        });
    },

The callback of this method is never called - and when I open the developer tools , the callback function is called and working fine
saveData: function(component){
        var action = component.get("c.saveClient");
        actionJInsured.setParams({
            "firstname": firstname,
            "lastname": lastname,
            "title": "title"
        });
        action .setCallback(this, function(response){
            var state = response.getState();
            if (component.isValid() && state === "SUCCESS") {
                alert('inside the callback');
            }
        });
        $A.enqueueAction(action);
    }

does any one has an explanation of why the code is only working when open the developer tools in the browser please?
Hi,
I am calling a method saveData from my js controller when all the fields of my form are filled :
$("#myForm").validate({
            rules: {
                title: {required: true},
                firstname: {required: true},
                lastname: {required: true},
            },
            messages: {
                title:  "Please type and select a title",
                firstname: "Please enter the client first name",
                lastname: "Please enter the clients last name",
            },   
            tooltip_options:{
                '_all_': {placement: 'top'},
            },
            focusInvalid: false,
            submitHandler: function() {
                if($('#confirmation').prop("checked") == false ){
                    helper.showErrorMessage();
                }else {
                    helper.saveData(component);
                }
            }
        });
    },

The callback of this method is never called - and when I open the developer tools , the callback function is called and working fine
saveData: function(component){
        var action = component.get("c.saveClient");
        actionJInsured.setParams({
            "firstname": firstname,
            "lastname": lastname,
            "title": "title"
        });
        action .setCallback(this, function(response){
            var state = response.getState();
            if (component.isValid() && state === "SUCCESS") {
                alert('inside the callback');
            }
        });
        $A.enqueueAction(action);
    }

does any one has an explanation of why the code is only working when open the developer tools in the browser please?
Hi,
I am calling a method saveData from my js controller when all the fields of my form are filled :
$("#myForm").validate({
            rules: {
                title: {required: true},
                firstname: {required: true},
                lastname: {required: true},
            },
            messages: {
                title:  "Please type and select a title",
                firstname: "Please enter the client first name",
                lastname: "Please enter the clients last name",
            },   
            tooltip_options:{
                '_all_': {placement: 'top'},
            },
            focusInvalid: false,
            submitHandler: function() {
                if($('#confirmation').prop("checked") == false ){
                    helper.showErrorMessage();
                }else {
                    helper.saveData(component);
                }
            }
        });
    },

The callback of this method is never called - and when I open the developer tools , the callback function is called and working fine
saveData: function(component){
        var action = component.get("c.saveClient");
        actionJInsured.setParams({
            "firstname": firstname,
            "lastname": lastname,
            "title": "title"
        });
        action .setCallback(this, function(response){
            var state = response.getState();
            if (component.isValid() && state === "SUCCESS") {
                alert('inside the callback');
            }
        });
        $A.enqueueAction(action);
    }

does any one has an explanation of why the code is only working when open the developer tools in the browser please?