• Resolved iantresman

    (@iantresman)


    Can Calculated Fields pre-populate a hidden field with “referrer” information?

    For example, if I have a link on one page to my form, can the form access and pre-populate a field with the PHP “referral” data which consists of the URL of the referring page?

    Or could URL query data be used to pre-populate a field?

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @iantresman

    If you want pre-fill some fields in the form with URL’s parameters, yes, that’s possible, using the shortcodes for variables: [CP_CALCULATED_FIELDS_VAR]

    I’ll try to describe the process with a hypothetical example. Assuming the URL to your web page is:

    https://www.yourwebsite.com/your-page/?param1=123&param2=456

    And you want to pre-fill two fields in the form with id="1" with the values of these parameters.

    First, insert into the content of the webpage the shortcode for the form, and two shortcode to generate the javascript variables based on the URL’s parameters:

    
    [CP_CALCULATED_FIELDS_VAR name="param1"]
    [CP_CALCULATED_FIELDS_VAR name="param2"]
    [CP_CALCULATED_FIELDS id="1"]
    

    Second, insert two calculated fields in the form, that you can configure as hidden (through a checkbox in their settings), whose equations would be simply the names of variables generated previously.

    For the first calculated field the equation would be: param1
    and for the second calculated field, the equation: param2

    More information about the shortcode for variables in the following link:
    https://cff.dwbooster.com/documentation#javascript-variables

    Concerning to your second question: populate fields in the form with server side code. In this case you would need to implemente server side equations, using the “SERVER SIDE EQUATIONS” addp-on. More information in the following posts of the plugin’s blog:

    https://cff.dwbooster.com/blog/2018/10/01/server-side-equations

    https://cff.dwbooster.com/blog/2019/08/04/partial

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Support for “referrer”’ is closed to new replies.