Support

Account

Home Forums Add-ons Repeater Field Radio Button and Repeater Subfields Reply To: Radio Button and Repeater Subfields

  • Yes, I think there is. Since the additional fields are based on the radio button field, get the radio button field and test it’s value to determine which of the other fields to get and display.

    
    if ($radio == 'choice_1') {
      // display fields
    } elseif ($radio == 'choice_2') {
      // display fields
    } elseif etc...
    

    or better yet

    
    switch ($radio_field) {
      case 'choice 1':
        //display fields
        break;
    }
    

    If fields can be displayed for multiple choices you may want to put them into functions so they can be called that way rather than duplicating the code to display them over and over again.

    You’ll also find that sooner or later you’ll be showing the wrong fields. For example, if they change the choice later that hides one of the fields the hidden field will still have a value, so you’ll need to check the radio field for that reason any way.