• Resolved 0wordpress0user0

    (@0wordpress0user0)


    Hello

    There is a need to create a clickable link in an e-mail (resulting from a Contact 7 form submission) that will automatically prefill the next form. The problem is, some fields like names does not properly format in the clickable link because of SPACES in names (e.g. some people have spaces in their last name).

    I used the documentation at https://contactform7.com/getting-default-values-from-the-context/ and created a form that crates an email link which I can use to populate another form.

    PROBLEM DESCRIPTION – NEED HELP WITH THIS.
    All is good with the above process except when the form submission has SPACES and in that case the email link breaks. The issue is similar to what is described at https://www.jotform.com/help/164-Pass-Value-to-Another-Form-with-URL-Encoding

    Will appreciate your help.

    Thanks

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    You can do it with this technique: Customizing mail-tag replacement

    Thread Starter 0wordpress0user0

    (@0wordpress0user0)

    Thank you so much for such a quick response, much appreciated. I will follow those instructions. Again, thanks!

    Thread Starter 0wordpress0user0

    (@0wordpress0user0)

    FOLLOW UP
    ———
    Have a follow up question after trying out the suggestions at https://contactform7.com/2019/12/08/customizing-mail-tag-replacement/

    I used the code below as example on how to deal with empty spaces in someone’s First Name. It works fine, the code below replaces the empty space in the user submission with a +. The resulting link created using the mail-tag “firstname” does not break either because of a empty space. So all good here.

    /* Customizing mail-tag replacement START
    https://contactform7.com/2019/12/08/customizing-mail-tag-replacement/
    */
    add_filter( ‘wpcf7_mail_tag_replaced’,

    function( $replaced, $submitted, $html, $mail_tag ) {
    if ( ‘firstname’ == $mail_tag->field_name() ) {
    if ( is_string( $submitted ) ) {
    $replaced = urlencode( $submitted );
    }
    }

    return $replaced;
    },

    10, 4
    );
    /* Customizing mail-tag replacement END*/

    ISSUE DESCRIPTION
    ——————
    The issue now is that the mail-tag “firstname” is also used in the email greeting, e.g. Hello First Name which now becomes Hello First+Name

    POSSIBLE SOLUTION?
    —————–
    I found this as a possible solution; have 2 different mail-tags for First Name. One to handle the email greeting and the other to handle the email link. One would be a hidden field. Is this the best way to go about it or are there simpler alternatives.
    https://stackoverflow.com/questions/5896287/jquery-passing-value-from-one-input-to-another

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Pass Value to Another Form with URL Encoding’ is closed to new replies.