Announcement Announcement Module
Collapse
No announcement yet.
Entity field with --notNull --sizeMax Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Entity field with --notNull --sizeMax

    Hi all,
    I am adding a field "description" with the parameters "--notNull --sizeMax 4096" to an entity "License".
    When running the generated web application, I manage to create a License without nothing filled in the "description" text area, while I would have expected to get an error message preventing me from creating the license since the field description is empty. Furthermore, I don't have a hint box telling the description cannot be empty.
    For another field with "--notNull" that generates an html input, it does work: I've got the hint box telling the field is required and I can't create the license if I haven't filled the input.
    Is there something I've done wrong or is my expectation wrong?

    I attached a zip of my project.

    I used:
    - ROO 1.0.0.RC4
    - maven 2.2.1 and maven 3
    - Windows 7 (64bits)

    Thanks in advance,

    CÚdric.

  • #2
    Hi Cedric,

    This is unfortunately a known issue which we cannot resolve easily. This is because what you are seeing is a Dojo shortcoming rather than a Roo problem. See https://jira.springsource.org/browse/ROO-440 for details. Effectively Dojo TextAreas do not have a 'required' attribute.

    In order to trigger at least server side validation for your description field you should also define a '--sizeMin 1' attribute in the command which will check the length of incoming String values. The String itself is not null since the Spring MVC binding mechanism simply creates an empty String object.

    Comment


    • #3
      Thanks Stefan!
      I was wondering why there were no validation exception raised on the server side and thus, whether such field was initialized to null or an empty string.
      I will use the workaround you've suggested.

      Many thanks,

      CÚdric.

      Comment

      Working...
      X