View for new-create form?

Marc
2013-10-28
2014-03-08
  • Marc
    Marc
    2013-10-28

    Hello,

    I want to hide a text property in the form to create a new Entity. The property must be shown in update mode.

    I found out that the @NoCreate property does not work on this type of property.

    Is there a name for the view that is used to create a new entity instance? That would be anoter solution.

    Last resort would be to program it (dynamically) with setHidden. But i wanted with this question explore better alternatives.

    Thanks for your insigths,
    Marc

     
  • Javier Paniza
    Javier Paniza
    2013-10-30

    Hi Marc,

    @NoCreate only applies to references and collections and it has a completely different meaning.

    Your option of setHidden() is a good option. You can also define two views, one for updating and other for creating, but you have to refine the search and new actions to change the view, so it's not simpler than the setHidden() one.

    So, for now you have to solve it programmatically. If this case would be common enough we could add some annotation to specify which properties are only for updations. However, if it is not a common case is better to do it programmatically, adding a new annotation is not free, it adds complexity to the OX API. What do you think?


    Help others in this forum as I help you.

     
  • Hi Javier,

    If this case would be common enough we could add some annotation to specify >which properties are only for updations. However, if it is not a common case is >better to do it programmatically, adding a new annotation is not free, it adds >complexity to the OX API. What do you think?

    My experience is that this is frequently met use case.
    If you can support me with directions how to add this annotation to OpenXava I would invest my time to develop it.

    Kind regards,
    Trifon

     
  • Hayrol Reyes
    Hayrol Reyes
    2013-11-01

    I think this it is a real frequently use case that OX type applications face once and again. And I was also thinking about if it is better to extend @ReadOnly and take advantage of the logic in there to add an annotation property like forCRUDs={BOTH|CREATE|UPDATE}... with BOTH as default.

    By example I have an special case now, because I normally override the search action and use the getView().setEditable(String, boolean), on most of my Liferay based OX application... but now that we are using NaviOX ... it's not working any more. The override of the search action is never reached for any module.

    So, having this option will make easier the way to set over which part of the CRUD you want the ReadOnly to be applied in the result View that is going to be displayed.

    Regards,

     
    Last edit: Hayrol Reyes 2013-11-01
  • Marc
    Marc
    2013-11-02

    Well, I'm proud that I could launch a vivid subject.

    Just an afterthought from my side:

    An alternative design consists in providing a view specific to the new-create form. For instance, some applications show a section on history information (created by, last updated by,...). This information is not needed on the first form to create a new instance.

    With a specific view for the new-create form, we can thus not only discard properties but also entire groups or sections.

    Marc

     
  • Javier Paniza
    Javier Paniza
    2013-11-04

    Hi Marc,

    An alternative design consists in providing a view specific to the new-create form

    Very interesting indeed. We could add an attribute to the @View or still better using a "Convention over Configuration" approach, as we currently do for Search view, and we plan to do for reference and collection view.
    What do you think?

    Trifon, which options do you prefer? Annotating members with @UpdateOnly (or so) or using two views?


    Help others in this forum as I help you.

     
  • I would vote for the two views option, In my opinion it is clearer... In fact, I would like to have some kind of Annotation parameter with predefined standards like:

    @View( name="small", action="create"....

    Regards

     
    Last edit: Jose Roman Bilbao 2013-11-04
  • Javier Paniza
    Javier Paniza
    2013-11-06

    Hi,

    I just added a Feature Request in order to not lose this good ideas.


    Help others in this forum as I help you.

     
  • Dear Javier, definitly differnt views for Create and Update is a very common requirment. It should be included...

    Love your work,

    Thanks