• Resolved bruce-s

    (@3ruce)


    This page is very helpful in terms of understanding how to use multiple registration forms but how can I change the default value of a field when using different registration forms?

    In this example, I have a radio button field that I’d like to default to ‘1’ in the first form and ‘2’ in the second…

    Is this possible?

    Thanks!

    • This topic was modified 7 years ago by bruce-s.

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

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author xnau webdesign

    (@xnau)

    Yes, you’ll need to use a custom template for that. So, you’ll need to have some knowledge of PHP to do this, but it’s fairly simple. I’ve published a tutorial that explains the basic idea:

    https://xnau.com/setting-the-default-value-of-a-field-in-a-custom-template/

    Thread Starter bruce-s

    (@3ruce)

    Thank you, I’ll check this out… Have a great labor day!

    Thread Starter bruce-s

    (@3ruce)

    Can I insert the code you suggested on that page using the insert-php plugin as below, or have I got to use the template approach?

    <?php
     // first identify the field we need to change
     if ( $this->field->name === 'selector' ) {
        /* 
         * now set it's default value, 
         * which is the field's pre-set value
         */
        $this->field->value = 'red';
     } ?>
    • This reply was modified 7 years ago by bruce-s.
    Plugin Author xnau webdesign

    (@xnau)

    It’s got to be in the template.

    Thread Starter bruce-s

    (@3ruce)

    ok… so if I use the [pdb_list template=pdb-signup-default] approach, do I add the other fields and groups into the shortcode or into the pdb-signup-default.php template file?

    Plugin Author xnau webdesign

    (@xnau)

    Read the article on using custom templates, it will explain how to match templates to the shortcode. The signup template can’t be used for the list shortcode.

    Choosing which fields or groups are shown has to be done in the shortcode, it can’t be done in the template.

    Thread Starter bruce-s

    (@3ruce)

    I’m going to mark this as resolved…

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to change the default value of a field when using 2 or 3 registration forms’ is closed to new replies.