Add support for radio inputs.

Created on 30 July 2024, 5 months ago

Problem/Motivation

The module currently doesn't support radio inputs, it'd be nice if it did.

Steps to reproduce

Attempt to calculate and listen to radio inputs currently doesn't work.

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @codebymikey
  • Status changed to Needs review 5 months ago
  • Pipeline finished with Success
    5 months ago
    Total: 186s
    #238106
  • Pipeline finished with Success
    5 months ago
    Total: 199s
    #240819
  • 🇧🇷Brazil joaopauloc.dev

    joaopauloc.dev changed the visibility of the branch 3464607-radio-support to hidden.

  • Status changed to Needs work 3 months ago
  • 🇧🇷Brazil joaopauloc.dev

    hey @codebymikey, thanks for your contribution, appreciate that.
    but unfortunately, the changes didn't work in webforms.

    I changed the field to_divide to use radios instead numbers but the field was not rendered as expected.

    Follow the screenshot.
    Field display:

    Field settings.

  • It still says the to_divide field type is Number on the webform list, which would mean it's either not saved or there's something else going on with your instance.

    Here's an example webform config based off the example one in the module that you can use for your test:

    loan_amount:
      '#type': number
      '#title': 'Loan Amount'
      '#required': true
    interest_rate:
      '#type': number
      '#title': 'Interest Rate'
      '#required': true
    loan_term:
      '#type': radios
      '#title': 'Loan Term'
      '#options':
        1: '1 year'
        2: '2 years'
        3: '3 years'
        4: '4 years'
        5: '5 years'
      '#required': true
    result:
      '#type': form_calculation_element
      '#title': result
      '#evaluation_decimals': 2
      '#evaluation_fields': '((:loan_amount / :loan_term) + ((:interest_rate / 100) * :loan_amount)) * :loan_term'
    
  • Status changed to RTBC 3 months ago
  • 🇧🇷Brazil joaopauloc.dev

    I didn't push the webform changes. It was a local test. Whatever, I tested it again in a new instance, and worked like a charm.

    Thank you @codebymikey. This feature will be available in the next release, 1.0.4. I'm working on other tickets including one of you who opened and we plan to launch everything together.

  • 🇮🇪Ireland frankdesign

    Thanks for the MR for Radio field, which works perfectly in Webform. But it still doesn't work with Radios Other in Webform. Is it possible to work with that too?

    Thanks

  • 🇮🇪Ireland frankdesign

    Also, just to note, if a Radio button is selected by Default on page load, then the calculation does not occur (even with the MR above applied). The calculation only occurs when the radio button is changed.

    FYI - Number fields that have a Default value on page load do calculate using that Default value.

    Thanks

    F

Production build 0.71.5 2024