Announcement

Collapse
No announcement yet.

Problem with C&P Gravity Form Plugin Validation Code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with C&P Gravity Form Plugin Validation Code

    We have a Wordpress website with Gravity Forms installed along with the Gravity Forms Click & Pledge plugin created by C&P (https://wordpress.org/plugins/gravit...-click-pledge/). We are running the latest version of WP, GF and GF C&P plugins.

    We have added a name prefix to our forms, and make it a required field through Gravity Form settings. However, we have found a problem where users that fail to enter a name prefix and submit their form are presented with an error message about the missing field (screenshot -- https://prnt.sc/hvbls9), even though the C&P plugin still processes their donation and charges their credit card. Here is a screenshot of the transaction in C&P despite the fact that it showed an error when trying to submit through the website form: http://prntscr.com/hvbryz.

    This problem occurs with all forms on the website that are connected to our C&P account. Here is a link to the one-time donation form presented in the screenshot referenced above:
    https://stmichaelsabbey.com/one-time-donation/

    This is a big problem as it is causing donors to believe their initial submission and donation was not received, so they enter a name prefix and resubmit, resulting in a double charge.

    for now we just disable prefix required field.

    Please advise. Thank you.

  • #2
    Good day @dgkasun

    Please submit a support ticket at http://help.clickandpledge.com with FTP and admin login details as well as the website URL so we can review your entire configuration. Include the link to this post in the ticket for reference.

    Please let us know here when you have submitted the ticket. Do not post the requested information in this forum as this is a public forum.
    Regards,
    Click & Pledge Support Department

    On Salesforce? Help us by rating our app: Click & Pledge Donor Management on AppExchange

    Join us @ the educational webinars: https://clickandpledge.com/webinars/
    Live Support available Join between 3:00 - 3:30 p.m. ET Monday - Thursday: https://clickandpledge.com/webinars/
    Are you on Salesforce? Join us at the Power of Us Hub: https://powerofus.force.com/0F980000000CjpC

    Comment


    • #3
      I just submit ticket there. but it didn't give me ticket number. finally got automatic email. end of email have reference to Case # #59609
      it will help you?
      please let me know.

      Comment


      • #4
        Good day @dgkasun

        Thank you for your response. We have received the information but when we try to login to FTP it is NOT authenticating. Would you please review the credentials and let us know?

        I have a question for you from one of our developers: Did you add any validation for the prefix in Form Settings OR Custom Validation?

        Looking forward to hearing back from you.
        Regards,
        Click & Pledge Support Department

        On Salesforce? Help us by rating our app: Click & Pledge Donor Management on AppExchange

        Join us @ the educational webinars: https://clickandpledge.com/webinars/
        Live Support available Join between 3:00 - 3:30 p.m. ET Monday - Thursday: https://clickandpledge.com/webinars/
        Are you on Salesforce? Join us at the Power of Us Hub: https://powerofus.force.com/0F980000000CjpC

        Comment


        • #5
          It is sftp login. it should work.
          yes we try it through custom coding. Gravity support gave us the code. you want that code?

          Comment


          • #6
            Good day @dgkasun

            Yes, we need that code. We have tried with sftp but it is not authenticating:

            Click image for larger version

Name:	SFTP.jpg
Views:	66
Size:	97.2 KB
ID:	37188


            Please check the credentials and share the code.

            Looking forward to hearing back from you.
            Regards,
            Click & Pledge Support Department

            On Salesforce? Help us by rating our app: Click & Pledge Donor Management on AppExchange

            Join us @ the educational webinars: https://clickandpledge.com/webinars/
            Live Support available Join between 3:00 - 3:30 p.m. ET Monday - Thursday: https://clickandpledge.com/webinars/
            Are you on Salesforce? Join us at the Power of Us Hub: https://powerofus.force.com/0F980000000CjpC

            Comment


            • #7
              the user is wrong.
              i sent user and new password through support ticket.
              reference to Case # #59653.
              also attached custom code. there have 3 forms we trying to add required field for prefix. so there have 3 filters in code. I can't add .php file. so add as .txt file.
              Thank you for your time have a good day!

              Attached Files

              Comment


              • #8
                Good day @dgkasun

                One of our developers reviewed your code and concluded that _6 in the below line refers to the form number and it should be removed from the code:

                add_filter( 'gform_validation_6', 'customvalidation' );

                Please test by removing _6 from your code and let us know if you find any issues.
                Regards,
                Click & Pledge Support Department

                On Salesforce? Help us by rating our app: Click & Pledge Donor Management on AppExchange

                Join us @ the educational webinars: https://clickandpledge.com/webinars/
                Live Support available Join between 3:00 - 3:30 p.m. ET Monday - Thursday: https://clickandpledge.com/webinars/
                Are you on Salesforce? Join us at the Power of Us Hub: https://powerofus.force.com/0F980000000CjpC

                Comment


                • #9
                  _6 mean specific form id. if we remove _6 then it will apply on all our forms. we don't need to do on other forms.

                  Comment


                  • #10
                    Good day @dgkasun

                    Please check this code:

                    add_filter( 'gform_field_validation_2_11', function ( $result, $value, $form, $field ) {
                    if ( $field->type == 'name' ) {
                    // Input values
                    $prefix = rgar( $value, $field->id . '.2' );
                    $first = rgar( $value, $field->id . '.3' );
                    $last = rgar( $value, $field->id . '.6' );


                    if ( empty( $prefix ) && ! $field->get_input_property( '2', 'isHidden' )
                    || empty( $first ) && ! $field->get_input_property( '3', 'isHidden' )
                    || empty( $last ) && ! $field->get_input_property( '6', 'isHidden' )

                    ) {
                    $result['is_valid'] = false;
                    $result['message'] = empty( $field->errorMessage ) ? __( 'This field is required. Please enter a complete name.', 'gravityforms' ) : $field->errorMessage;
                    } else {
                    $result['is_valid'] = true;
                    $result['message'] = '';
                    }
                    }


                    In this line add_filter( 'gform_field_validation_2_11' 2 is form id & 11 is Field ID.

                    Please check and let us know if can be of more help.

                    Regards,
                    Click & Pledge Support Department

                    On Salesforce? Help us by rating our app: Click & Pledge Donor Management on AppExchange

                    Join us @ the educational webinars: https://clickandpledge.com/webinars/
                    Live Support available Join between 3:00 - 3:30 p.m. ET Monday - Thursday: https://clickandpledge.com/webinars/
                    Are you on Salesforce? Join us at the Power of Us Hub: https://powerofus.force.com/0F980000000CjpC

                    Comment


                    • #11
                      Hi, I just try with this code. look like there have syntax error. can you please look.
                      i notice it missing last " } " but still getting syntax error.
                      Last edited by dgkasun; 01-16-2018, 02:47 AM.

                      Comment


                      • #12
                        Good day @dgkasun

                        Sorry for the inconvenience. Yes, you are correct, the last two lines missed in above code.

                        Please replace it with below code:

                        add_filter( 'gform_field_validation_2_11', function ( $result, $value, $form, $field ) {
                        if ( $field->type == 'name' ) {
                        // Input values
                        $prefix = rgar( $value, $field->id . '.2' );
                        $first = rgar( $value, $field->id . '.3' );
                        $last = rgar( $value, $field->id . '.6' );


                        if ( empty( $prefix ) && ! $field->get_input_property( '2', 'isHidden' )
                        || empty( $first ) && ! $field->get_input_property( '3', 'isHidden' )
                        || empty( $last ) && ! $field->get_input_property( '6', 'isHidden' )

                        ) {
                        $result['is_valid'] = false;
                        $result['message'] = empty( $field->errorMessage ) ? __( 'This field is required. Please enter a complete name.', 'gravityforms' ) : $field->errorMessage;
                        } else {
                        $result['is_valid'] = true;
                        $result['message'] = '';
                        }
                        }

                        return $result;
                        }, 10, 4 );


                        Please check and let us know if you find any issues.
                        Regards,
                        Click & Pledge Support Department

                        On Salesforce? Help us by rating our app: Click & Pledge Donor Management on AppExchange

                        Join us @ the educational webinars: https://clickandpledge.com/webinars/
                        Live Support available Join between 3:00 - 3:30 p.m. ET Monday - Thursday: https://clickandpledge.com/webinars/
                        Are you on Salesforce? Join us at the Power of Us Hub: https://powerofus.force.com/0F980000000CjpC

                        Comment


                        • #13
                          This works! Thank you so much for your help.

                          Comment

                          Working...
                          X