• Resolved Michael Rieder

    (@teamtacho)


    Dear Team

    I’m using e.g. getField(fieldname24|n, ‘.highscore’).val() in order to transfer one field value to another form on the same page. It works perfectly.

    I also using getField(fieldname24|n, ‘.grundumsatz’).val() from a second form on the same page for the same purpose. I don’t get the value.

    My two questions:

    where can I find the right form name (which is not the title)?

    can I use the form ID instead of the name. Maybe that solves my problem.

    Best Regards Michael

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

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

    (@codepeople2)

    Hello @teamtacho,

    Thank you very much for using our plugin.

    The second parameter of the getField operation is not the form name. Instead, it is a selector used to identify the specific form instance on the page.

    For example, the following code works correctly because you have assigned the class name highscore to the main form:

    getField(fieldname24|n, '.highscore').val()

    Please note that custom class names are assigned to forms through their shortcodes, for example:

    [CP_CALCULATED_FIELDS id="6" class="highscore"]

    It is also important to keep in mind that the plugin automatically assigns a CSS class based on the form ID. For instance, if a form has the ID 7, the plugin will automatically add the class:

    cff-form-7

    Therefore, you can reference a field in Form 7 as follows:

    getField(fieldname24|n, '.cff-form-7').val()

    However, if the same form (Form 7) is inserted multiple times on the same page, all instances will share the same automatically generated class name, creating ambiguity. In that case, the recommended solution is to assign a unique custom class to each form instance through its shortcode and use those custom class names in your getField calls.

    Thank you.

    Thread Starter Michael Rieder

    (@teamtacho)

    That’s it! Thank very much.

    If I hadn’t already given you 5 stars, I would definitely do so now

    Plugin Author CodePeople2

    (@codepeople2)

    Hello @teamtacho

    Thank you very much.

    Best regards.

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

You must be logged in to reply to this topic.