Problem/Motivation

Part 5 of splitting #3595219: 3.0 Exploration. This issue exposes a set of per-element configuration fields that are currently missing for numeric, text, container and a few simple element types, plus telephone submission handling. These are grouped because each is a small, independent field-exposure on an existing element type.

Missing fields in 3.x:

  • Numeric (number, range): min, max, step, readonly, and the range output mode.
  • Text (textfield, textarea, autocomplete): counter settings (count by character/word, limit, message) and input_hide.
  • Color: colorSize.
  • Details container: open.
  • Containers (extending ContainerBase): randomize.
  • Signature: readonly.
  • Telephone (tel): the international/format fields, and submissions of phone numbers are not validated/accepted.

Proposed resolution

  • Add a numeric interface exposing min / max / step (+ readonly) and a WebformRangeOutput enum for the range output mode.
  • Expose counter settings via a webform_element_counter producer and a WebformCounterType enum, plus input_hide via a WebformDescriptionPlacement-style enum where relevant.
  • Expose colorSize (with WebformColorSize enum), details open, container randomize and signature readonly.
  • Expose tel fields (with WebformPhoneNumberFormat enum) and accept/validate phone-number submissions in WebformSubmit.php.

Remaining tasks

  • Add enums WebformRangeOutput, WebformCounterType, WebformColorSize, WebformPhoneNumberFormat, WebformDescriptionPlacement under src/Enum/; wire into WebformSchemaBuilder.php.
  • Add src/Plugin/GraphQL/DataProducer/WebformElementCounter.php; extend WebformElementMetadata.php / WebformElementProperty.php for the new fields.
  • Register the new fields/interfaces in WebformExtension.php.
  • Validate phone-number submissions in WebformSubmit.php.
  • Tests: NumericFieldsTest, NumericBaseExtrasTest, CounterTest, InputHideTest, ColorTest, DetailsTest, FlexboxTest, SignatureTest, TextFieldTest, TelTest, FormSubmissionTelephoneValidationTest, plus the matching tests/queries/*.gql fixtures and shared test-form additions.

API changes

Additive: new fields on numeric / text / color / details / container / signature / tel elements, several new enums, and telephone submission validation. No fields removed.

Release notes snippet

Numeric, text, color, details, container, signature and telephone elements now expose their relevant configuration (min/max/step, readonly, counters, input hiding, color size, details open, container randomize, phone format), and telephone submissions are validated.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pfrenssen created an issue. See original summary.

pfrenssen’s picture

There is a small B/C break in here: we were previously exposing the min, max and step fields on numeric elements as integers, but in fact in the Webform module they can be configured as decimal values. In the MR the type is changed from Int to Float. We need to publish a change record.

  • pfrenssen committed c47f93e8 on 3.x
    feat: #3598988 Numeric/text/misc fields
    
    By: dulnan
    By: pfrenssen
    
pfrenssen’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.