• Hi, i have a question about the dynamic_radio: when using this code:

    [dynamic_radio testRadio1 “0” “1” “2” “3” “4” “5”]

    Then the “0” value has no label, when using this code:

    [radio testRadio2 “0” “1” “2” “3” “4” “5”]

    it works correctly. (but then i don’t benefit the dynamic possibilities. 🙂 ) I also miss the borderline around the set of values.

    see screenshot: https://i.sstatic.net/4aHamwML.png (copy URL to new browser tab)

    do i something wrong in my code?

    • This topic was modified 9 months, 3 weeks ago by h1lbert.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter h1lbert

    (@h1lbert)

    is there a link with this item?

    https://wordpress.org/support/topic/error-with-option-value-0-for-a-dynamic-radio-button/

    i found it in the change log.

    Thread Starter h1lbert

    (@h1lbert)

    On line 590 in Utilities.php, the Label is evaluated if it is empty or not:

    if (!empty(trim($label_text))) {

    but !empty will evaluate as false for 0 (zero)

    changing code to:

    if ((!empty(trim($label_text)))||($label_text == "0")) {

    fixes my problem. Can you see if you can implement this or a simular solution for the missing 0 label?

    thanks a lot!

    • This reply was modified 9 months, 3 weeks ago by h1lbert.
    Thread Starter h1lbert

    (@h1lbert)

    I found the problem why the labels are below the radio button, instead of to the right of it, and why the border is missing around the group of radiobuttons. There is a difference between default CF7 radio button and DTX: there is an extra SPAN to create the border around the buttons. The class “wpcf7-form-control wpcf7-radio” is added to the extra SPAN. in DTX the class is assigned to the Input, but you have multiple inputs in a set of radio buttons. with Radiobuttons, this class should go to the SPAN, not the Input itself.

    I can fix this by changing line 320 in utilities.php, add an if statement to exclude this part of the code when it is a radio button:

    if ($type != 'radio') {
    $values = explode(' ', wpcf7_form_controls_class($type));
    $values[] = 'wpcf7dtx';
    $values[] = sanitize_html_class('wpcf7dtx-' . $type);
    }


    now the class is no longer assigned to the input when it is a radio button.
    then adapt: line 610 in contact-form-7-dynamic-text-extension.php to add the extra SPAN in a Radiobutton group with the correct class: “wpcf7-form-control wpcf7-radio”

    str_replace('%2$s%3$s','<span class="wpcf7-form-control wpcf7-radio">%2$s%3$s</span>',str_replace('<span class=', '<span%4$s class=', $wrapper)),

    Now it works as expected. Can you consider this or similar solution for next version?

    thanks!

    Plugin Author Tessa (they/them), AuRise Creative

    (@tessawatkinsllc)

    Hi! I just wanted to pop-in and say I read this and will add it in the next update in September. My day-job and side hustle have kept me busy so I haven’t had the time to provide the free support and updates as I would like to. Thank you for your work!

    I’ll reply here and mark as done when the update is released as well.

    Plugin Author Tessa (they/them), AuRise Creative

    (@tessawatkinsllc)

    Popping in to prevent this thread from automatically closing. This fix will be included in version 6. I just released version 5.0.4 today and wanted to give you a heads up when you go to update.

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

You must be logged in to reply to this topic.