Problem/Motivation

Numeric element properties like #minlength and #maxlength are being saved as strings when they should be cast to integers.

Instead of saving...

textfield:
  '#type': textfield
  '#title': textfield
  '#minlength': '1'
  '#maxlength': '100'
  '#size': '4'

...it should be...

textfield:
  '#type': textfield
  '#title': textfield
  '#minlength': 1
  '#maxlength': 100
  '#size': 4

Proposed resolution

Save numeric element properties as integers or floats instead of strings.

Numeric properties

  • autocomplete_limit
  • autocomplete_match
  • counter_maximum
  • counter_minimum
  • date_increment
  • default_value
  • flex
  • max
  • maxlength
  • min
  • minlength
  • multiple__add_more_items
  • multiple__empty_items
  • multiple__min_items
  • rows
  • size
  • step

Remaining tasks

  • Write code
  • Update webform plugin report
  • Update existing elements
  • Write test
  • Write change record

User interface changes

None

API changes

None

Data model changes

Element properties can now use numeric values.

Release notes snippet

TBD

Comments

jrockowitz created an issue. See original summary.

jrockowitz’s picture

Title: Use NULL for empty numeric properties. » Save numeric element properties as integers or floats instead of strings
Issue summary: View changes
jrockowitz’s picture

Issue summary: View changes
jrockowitz’s picture

Status: Active » Needs review
StatusFileSize
new6.5 KB
jrockowitz’s picture

StatusFileSize
new10.15 KB
jrockowitz’s picture

StatusFileSize
new5.22 KB

The attached webform illustrates the problem before the patch is applied.

jrockowitz’s picture

StatusFileSize
new10.53 KB
jrockowitz’s picture

Issue summary: View changes
jrockowitz’s picture

Status: Needs review » Fixed

  • jrockowitz authored 882ba6d on 8.x-5.x
    Issue #3108150 by jrockowitz: Save numeric element properties as...
jrockowitz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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