• Resolved avinash24

    (@avinash24)


    Hi i am trying to use both of hooks forminator_form_after_save_entry

    and

    forminator_form_after_handle_submit both not working even i try to alert a simple hello after success message even i try most of example which you given in answer
    basically i want to get all data and send through another api

    i don’t even know the code is working or not because it does not display any output

    i try this

    add_action( ‘forminator_form_after_save_entry’, ‘my_form_submit’, 10, 2 ); function my_form_submit( $form_id, $response ) { if ( $response && is_array( $response ) ) { if ( $response[‘success’] ) { if ( $form_id == THE_FORM_ID ) { $entry = Forminator_Form_Entry_Model::get_latest_entry_by_form_id( $form_id ); } } } }

    and this

    add_action( ‘forminator_form_submit_response’, ‘save_fielder_details’, 10, 2); add_action( ‘forminator_form_ajax_submit_response’, ‘save_fielder_details’, 10, 2); function save_fielder_details($response, $form_id) { error_log(print_r($response, true)); return $response; }


    can you please help
    replay asap very helpful

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support Saurabh – WPMU DEV Support

    (@wpmudev-support7)

    Hi @avinash24

    Hope you are doing fine!

    I have shared your request with our Second Level Support team, they will review it and once they provide a reply we’ll provide an update in this thread.

    Please keep in mind they handle more complex issues and their response may take some considerable time.

    Thanks in advance for your patience.

    Kind regards

    Luis

    Plugin Support Saurabh – WPMU DEV Support

    (@wpmudev-support7)

    Hi @avinash24

    The team has reviewed your request and provided the following code. Could you please test and let know if it works as expected?

    add_action ( 'forminator_form_after_handle_submit', 'my_form_submit', 10, 2 );
    add_action( 'forminator_form_after_save_entry', 'my_form_submit', 10, 2 ); 
    
    function my_form_submit( $form_id, $response ) { 
    
        if ( $response && is_array( $response ) ) {
             if ( $response['success'] ) { 
                if ( $form_id == 6 ) { 
                    $entry = Forminator_Form_Entry_Model::get_latest_entry_by_form_id( $form_id ); 
                  
    
                } 
            } 
        } 
    }
    
    
    add_action( 'forminator_form_submit_response', 'save_fielder_details', 10, 2); 
    
    add_action( 'forminator_form_ajax_submit_response', 'save_fielder_details', 10, 2); 
    
    function save_fielder_details($response, $form_id) {
    
            return $response; 
        
    }

    I understand the logs were added for testing purposes, I have remove them in the example below.

    Hope this information helps.

    Kind regards

    Luis

    Thread Starter avinash24

    (@avinash24)

    Thanks for the solution I have already completed with using below hook

    forminator_form_after_save_entry

    Plugin Support Adam – WPMU DEV Support

    (@wpmudev-support8)

    Hi @avinash24

    Thank you for updating us!

    I understand that we can consider the case closed then, so I’m marking it as resolved but if you have any follow-up questions, please don’t hesitate to re-open the ticket (or, if you have other questions, start new ones).

    Best regards,
    Adam

    Thread Starter avinash24

    (@avinash24)

    hi 
    
    i am using this code its sending the data to the api but shows form error even form submitted 
    
    An error occurred while processing the form. Please try again
    
    add_action( 'forminator_custom_form_submit_before_set_fields', function( $entry, $form_id, $field_data_array ) {
    
     // Can be replaced using $entry variable, to find out
     // what is included in entry variable, use error_log( print_r($entry, true ) ); then check debug.log
     // This is a simple way
    
      $emailNo = intval($_POST['number-1']);
     $trademarked =  $_POST['select-1'];
     $configure = $_POST['select-2'];
     $FirstName = $_POST['name-1'];
     $LastName = $_POST['name-2'];
     $OrganizationName = $_POST['text-1'];
     $Email = $_POST['email-1'];
     $PhoneNumber = $_POST['phone-1'];
     $Country = $_POST['address-1-country'];
     $AddressLine1 = $_POST['address-2-street_address'];
     $AddressLine2 = $_POST['address-3-street_address'];
     $Zipcode = $_POST['address-4-zip'];
     $Region = $_POST['address-5-state'];
     $transaction_id = $field_data_array[15]['value']['transaction_id'];
     $productname = $field_data_array[15]['value']['product_name'];
     $status = $field_data_array[15]['value']['status'];
     $amount = $field_data_array[15]['value']['amount'];
     $cat = 'Digicert';
     $provider = 'Stripe';
     $paymenttype = 'Payment';
     $portaltype = 'Retail';
    
     $url = 'api url';
    
     $data = [
        "username" => $Email,
        "couponcode" => "",
        "coupondiscount" => "0",
        "resonseobj" => null,
        "portaltype" => $portaltype,
        "productdetails" => [
              [
                 "category" => $cat,
                 "productname" => $productname,
                 "totalsans" => 0,
                 "qty" => $emailNo,
                 "validity" => 12,
                 "domainname" => $configure,
                 "servertype" => $trademarked,
                 "supporttype" => null
              ]
           ],
        "Paymentmodel" => [
                    "key" => null,
                    "salt" => null,
                    "txnid" => $transaction_id,
                    "amount" => $amount,
                    "userfundamount" => "0",
                    "productinfo" => null,
                    "fname" => $FirstName,
                    "email" => $Email,
                    "mobile" => $PhoneNumber,
                    "udf5" => null,
                    "hash" => null,
                    "status" => $status,
                    "mihpayid" => "0",
                    "userid" => 0,
                    "gatwaytransactionid" => "0",
                    "provider" => $provider,
                    "paymenttype" => $paymenttype
                 ],
        "billingmodel" => [
                       "bfirstName" => $FirstName,
                       "blastName" => $LastName,
                       "baddress1" => $AddressLine1,
                       "baddress2" => $AddressLine2,
                       "bzipcode" => $Zipcode,
                       "bcountry" => $Country,
                       "bregion" => $Region,
                       "bphonenumber" => $PhoneNumber,
                       "btaxnumber" => "",
                       "borganizationname" => $OrganizationName
                    ],
        "registermodel" => [
                          "email" => $Email,
                          "firstname" => $FirstName,
                          "lastname" => $LastName,
                          "phonenumber" => $PhoneNumber,
                          "country" => $Country,
                          "region" => $Region,
                          "addressline1" => $AddressLine1,
                          "addressline2" => $AddressLine2,
                          "zipcode" => $Zipcode,
                          "organizationname" => $OrganizationName
                       ]
     ];
    
     $data_string = json_encode($data);
    
     // Send data to API
     $ch = curl_init($url);
     curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array(
         'Content-Type: application/json',
         'Content-Length: ' . strlen($data_string))
     );
     $result = curl_exec($ch);
    
     // Print the result
     print($result);
    
     error_log( print_r($emailNo, true ) );
     error_log( print_r($trademarked, true ) );
     error_log( print_r($configure, true ) );
     error_log( print_r($FirstName, true ) );
     error_log( print_r($LastName, true ) );
     error_log( print_r($OrganizationName, true ) );
     error_log( print_r($Email, true ) );
     error_log( print_r($PhoneNumber, true ) );
     error_log( print_r($Country, true ) );
     error_log( print_r($AddressLine1, true ) );
     error_log( print_r($AddressLine2, true ) );
     error_log( print_r($Zipcode, true ) );
     error_log( print_r($Region, true ) );
     error_log( print_r($transaction_id, true ) );
     error_log( print_r($amount, true ) );
     error_log( print_r($productname, true ) );
     error_log( print_r($status, true ) );
     error_log( print_r($entry, true ) );
    
    }, 10, 3);
    • This reply was modified 1 year, 5 months ago by avinash24.
    Plugin Support Adam – WPMU DEV Support

    (@wpmudev-support8)

    HI @avinash24

    As for error:

    Do not print out CURL result like this:

     // Print the result
     print($result);

    It will “interrupt” data that Formiantor processes so either remove/comment out that line or – if you still need/want to have result logged – do it like this

    error_log( print_r( $result, true ) );

    Best regards,
    Adam

    Thread Starter avinash24

    (@avinash24)

    Hi thanks for help

    there is any way I can get first input logo value in JavaScript without form submit , if can you please send me the code

    below is screen short of form and where I want ri use the value in total after multiple with number of email logo as first input field

    https://prnt.sc/lq4Ggm9tUSOk

    Thanks in Advance

    Plugin Support Zafer – WPMU DEV Support

    (@wpmudevsupport15)

    Hi @avinash24,

    I hope you are doing well today!

    I believe you would like to get the first input value from the Forminator form without submitting it and perform some calculations.

    We are checking your request with our SLS team and will provide you an example code. Thanks for the patience in advance.

    Kind regards,
    Zafer

    Plugin Support Zafer – WPMU DEV Support

    (@wpmudevsupport15)

    Hi again @avinash24,

    Here below you can find the example code for you.

    jQuery(document).ready(function($){
    	$('#number-1 input').on('change', function(){
    		var logo_count = $(this).val(); 
    //Use logo_count to print 
    	});
    });

    It is assumed that the input field name is number-1.

    Kind regards,
    Zafer

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘forminator_form_after_save_entry,forminator_form_after_handle_submit not working’ is closed to new replies.