Tapestry + relationship-backed form components

From: Robert Zeigler (rdzeigl...arizona.edu)
Date: Tue Jul 13 2004 - 15:37:19 EDT

  • Next message: Eric Schneider: "Re: Tapestry + relationship-backed form components"

    Hi,

    I keep butting my head against the "can't set XXX because A and B are in
    a different data context" problem.
    I'm using cayenne with tapestry.
    I have a series of select boxes that are populated from lists obtained
    from a globally accessible object.
    The lists are obtained by querying for the available options using the
    user-session-specific DataContext.

    The problem occurs when I submit the form. Because the object to which
    the form fields are bound is not yet registered with a datacontext, an
    exception is thrown. I don't want to register the object before form
    submission because that tends to cause problems if the user navigates to
    some other area of the site without submitting the form.

    I've solved this problem in some places by doing:

            register the object before the form renders the first time; override
    validate for save for the object type to remove objects that are missing
    necessary information that is set in the code after form submission
    (this solves the problem of having an object in the context that
    shouldn't be committed).
            
    I've also thought about creating a property in the object subclass as a
    "temporary" holding value. However, neither of these solutions seems
    "right". What am I missing in cayenne to do this correctly?

    Thanks,

    Robert



    This archive was generated by hypermail 2.0.0 : Tue Jul 13 2004 - 15:37:16 EDT