Support

Account

Home Forums General Issues Select Dropdown Inside Repeater With Mailto and Tel based on Selection

Solving

Select Dropdown Inside Repeater With Mailto and Tel based on Selection

  • Trying to setup inside my Repeater a way for me to select either EMAIL ADDRESS or PHONE NUMBER.

    – if i select EMAIL ADDRESS, it would populate the ‘mailto:’ before the email subfield where i’d enter the email

    – if i select PHONE NUMBER, it would populate the ‘tel:’ before the phone number that’s entered into the field

    is there a way to do this with an if else using one field for the email/phone

    if i entered in the subfield: [email protected] or 333-333-4444, it could then know based on the dropdown selection whether to add mailto: or tel: before that field?

  • Do you need this to change on the backend or frontend? For the backend, you can change the prefix of a field using a filter. On the frontend, a regex to the field can determine whether to use mailto: or tel:.

  • 
    if (get_field('select_field_name') == 'EMAIL ADDRESS') {
      echo 'mailto:';
    } else {
      echo 'tel:';
    }
    
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.