Announcement Announcement Module
Collapse
No announcement yet.
How hide some (not null) fields in a view or how can I set them as read only? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How hide some (not null) fields in a view or how can I set them as read only?

    Hello all,

    in the domain I have a custom logic that automatically set some not null fields (clearly I have in the view many other fields, that are not intresting here, that are instead set by the user), defined as follow:

    @NotNull
    private Integer numero;

    @NotNull
    private Integer anno;

    @NotNull
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(style = "M-")
    private Date dataCreazione;

    I need only that these fields will be not shown on the view level, because I'll rewrite them at domain level, as I wrote above, when the user save the view data. Unlikely I have noticed that isn't so easy obtain this feature I really do not understand why... Anyway I had tried various approach and nothing seems to work...

    I really hope that this can be with a really simple definition, I don't know at which level (domain, controller or view). Remember that these fields are define as not null (anyway if the not null definition this is the problem I may change the fields definition, hoping that this helps...).

    Anyone has some suggestion?

    ROO version: spring-roo-1.2.0.RELEASE

    Regards,
    Paolo Del Signore
    Last edited by padesig; Mar 15th, 2012, 07:31 AM.

  • #2
    I can offer you to make this fields hidden. So they will exists on the form, but dosen't show.
    I do so, I extended input.tagx to hide fields and populate their values myself.

    Or you can just add render="false" to the field and handle errors in controller yourself.
    Just small suggestions.

    Comment


    • #3
      Solved with a little escamotage

      Originally posted by shvaber View Post
      I can offer you to make this fields hidden. So they will exists on the form, but dosen't show.
      I do so, I extended input.tagx to hide fields and populate their values myself.

      Or you can just add render="false" to the field and handle errors in controller yourself.
      Just small suggestions.
      No, thanks anyway... :-)!

      I have solved in the following way:

      1) in the domain I have set the fields ad nullable (comment out the @NotNull signature over each field)
      2) stating roo and force "hint" command to assure that ROO made sync the create.jspx at view level
      3) in the view I have set the render="false"
      4) again, in the domain I have placed the inner code to each customized setter involved in the change into the this.persist() function
      5) I haven't done any change to the DB (my persistent mode is always set as "update" and ROO doesn't change the DB field from not nul to null), than I have a "last bastion" for assuring consistence to the DB

      Anyway this is a really CUSTOM way to approach this problem, but is fast (and a bit dirty, I know )...

      Comment


      • #4
        thank you for your suggestion too. Great to know more ways

        Comment

        Working...
        X