Announcement Announcement Module
Collapse
No announcement yet.
Constraints not reflected in views Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Constraints not reflected in views

    Hi,

    I also noticed, that when you specify a length constraint, the maxlength field for inputs on the ui is not adjusted.
    Hi,

    here is the situation:
    I have a Customer object with an attribute named street. I added min and max constraints.
    Code:
    public class Customer {
    
        ...
    
        @Size(min=0, max=120)
        private String street;
        ...
    I scaffolded a controller and thought everything was great. However when recording my selenium tests I noticed that the field for street did not allow me to enter the complete test string I had chosen allthough it was definitely shorter than 120 chars. The problem is in the view automatically generated by roo. They length of the input does not fit the max value in the user constraint.

    Example:
    Presentation:
    Code:
    <form:input cssStyle="width:250px" id="_street_id" maxlength="30" path="street" size="0"/>
    Of course I could fix the maxlength attribute, but as soon as I need to make changes to my Customer object, the view with the wrong maxlength value will be regenerated.

    Is this a known problem? How could I work around this?

  • #2
    Yes we are working on making this a lot cleaner and more flexible. In the next few weeks you will see this appearing in the first milestone for Roo 1.1. Ideas are being collected here: http://jira.springframework.org/browse/ROO-8

    In the meantime, you will need to 'take over' the view artifacts for this controller so you can change the code in the relevant .jspx file. You can do that by setting @RooWebScaffold(automaticallyMaintainView=false,.. .)

    HTH

    Comment


    • #3
      Hi Stefan,

      thanks for your help. I had already disabled automatic view maintain, but forgot to mention it. That of course solves the problem of roo regenerating a 'wrong' view.

      Does the trick ;-)

      Danke

      Comment

      Working...
      X