• Resolved stanoman

    (@stanoman)


    I’m storing cookies when a CF7 form is submitted and then using CF7 Dynamic Text Extension to render the cookie in the form field. When I enabled dtx_pageload, it url-encodes the cookie, so, since it’s an email, it turns [email protected] into test%40gmail.com. Anyone know a way around this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thank you for your patience! There is a known bug when using cache compatibility mode and obfuscating together, specifically:

    Note: obfuscated values inserted via JavaScript don’t appear to the user as intended. The functionality works and saves obfuscated in the database so emails, storage, and hidden fields are not affected. Only visible form fields that are intended to be read by humans are affected in that they show the obfuscated mumbo jumbo instead of the human-readable format.

    If this particular email input field isn’t visible to the user, it should be fine and not affect functionality at all.

    input fields behave similarly to code and pre elements in that if the value was encoded, it displays it as-is rather than rendering it as HTML.

    For security purposes, the plugin intentionally does not decode values before inserting—it could potentially allow bad actors to insert malicious code into your form. However, for your use-case scenario, you can add a listener to the dtx_init javascript event that runs on the element after it’s been initialised. For example:

    let wpcf7dtxel = document.querySelector( '.wpcf7dtx' );

    wpcf7dtxel.addEventListener( 'dtx_init', function( e ) {

    console.info('DTX field initialised', e); // Delete me later, for testing purposes

    // Get the current input element
    let input = e.currentTarget; // The input element

    // TO-DO: optionally do some checks to verify this is the email field and not some other field

    // Decode value
    value = decodeURIComponent( input.getAttribute( 'value' ) );

    // TO-DO: optionally validate the value to ensure it is an email address and not something else

    // Set value of input field
    input.setAttribute( 'value', value );
    } );

    Note: this code is untested as I wrote it directly here in the response ??

    Please let me know if this works!

    Plugin Author Tessa (they/them), AuRise Creative

    (@tessawatkinsllc)

    Marking this thread as resolved due to inactivity.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.