[MGNLUI-6355] type property doesn't work in Text Field Created: 23/Oct/20  Updated: 23/Oct/20  Resolved: 23/Oct/20

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: 6.2.3
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Jonathan Ayala Assignee: Unassigned
Resolution: Not an issue Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 Description   

When using 6UI syntax to define a text field, type property doesn't work and throws an error.

Steps to reproduce:

  1. Use the following field to store a Long value within a component dialog:
    text:
          class: info.magnolia.ui.field.TextFieldDefinition
          type: java.lang.Long
          label: Long
  2. Try opening the component editor and you will see following error:
    java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String
  3. Try again replacing the class property with {{$type}:
    text:
          $type: textField
          type: java.lang.Long
          label: Long
  4. Retry opening the component dialog. Same error occurs.

Expected results:
Dialog opens correctly and a value of the configured type is stored.

Development notes:
It has been tested with SelectField and type property works ok, it seems that only happens with text field



 Comments   
Comment by Jonathan Ayala [ 23/Oct/20 ]

This can be fixed by using a converterClass:

long:
      $type: textField
      type: java.lang.Long
      converterClass: com.vaadin.data.converter.StringToLongConverter
Generated at Mon Feb 12 09:35:38 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.