• Resolved victoriei101

    (@victoriei101)


    Hello,
    can you please tell if it’s possible to pre-fill (populate) a number field from URL parameters? Something like /?cfffield1=123
    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @victoriei101

    Yes, that’s possible.

    For example, assuming it is a calculated field, you could enter the following equation into its settings:

    getURLParameter(cfffield1, '')

    If you want to pre-fill another field. For example, the number field fieldname34. You can insert a calculated field in the form as an auxiliary (you can configure it as hidden by ticking a checkbox in its settings), and enter the equation:

    getField(34).setVal(getURLParameter(cfffield1, ''));

    The getField operation receives the number component in a field’s name and returns its object representation.

    Another alternative would be to insert an “HTML Content” field in the form with the following code as its content:

    <script>
    fbuilderjQuery(document).one('showHideDepEvent', function(){
    getField(34).setVal(getURLParameter(cfffield1, ''));
    });
    </script>

    More information about the getURLParameter operation by visiting the following link:

    Best regards.

    Thread Starter victoriei101

    (@victoriei101)

    I’ve tried with both methods (calculated field and HTML) and added ?cfffield1=123 after the URL, but I don’t see any results.

    Here’s the url:
    https://notariate.ro/parameter

    and the added code
    https://ibb.co/6RkhdBt
    https://ibb.co/Qjy65Sn

    Plugin Author codepeople

    (@codepeople)

    Hello @victoriei101

    My apologies, my fault, the parameter name is a string, it must be enclosed between single or double quotes:

    getURLParameter('cfffield1', '')

    or

    getField(34).setVal(getURLParameter('cfffield1', ''));

    or

    <script>
    fbuilderjQuery(document).one('showHideDepEvent', function(){
    getField(34).setVal(getURLParameter('cfffield1', ''));
    });
    </script>

    Best regards.

    Thread Starter victoriei101

    (@victoriei101)

    Yes, this works. Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Pre-fill a field value’ is closed to new replies.