tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Zeigler (JIRA)" <j...@apache.org>
Subject [jira] [Created] (TAP5-1558) FormFragment should allow more fine grained control over when to be considered "invisible"
Date Sat, 25 Jun 2011 23:31:47 GMT
FormFragment should allow more fine grained control over when to be considered "invisible"

                 Key: TAP5-1558
                 URL: https://issues.apache.org/jira/browse/TAP5-1558
             Project: Tapestry 5
          Issue Type: Improvement
          Components: tapestry-core
    Affects Versions: 5.3.0
            Reporter: Robert Zeigler
            Priority: Minor

The 5.2 line of Tapestry introduced the "alwaysSubmit" parameter to form fragment.  This is
nice because it allows the fragment to be submitted even if hidden.  However, it doesn't cover
all use cases.  Consider a situation like:

   <div id="tab1">...<t:formfragment ...><t:textfield validate="required".../></t:formfragment></div>
   <div id="tab2">...<t:formfragment ...><t:textfield validate="required".../></t:formfragment></div>

User reveals tab 1, then reveals the form fragment on tab1 and makes changes. Now user reveals
tab2. Note that the fragment on tab1 is still revealed in the context of tab1, but the entire
tab1 is hidden.  There is currently no way to make it so that "submit" will submit the information
from the formfragment in both tabs and behave correctly in all situations. I will enumerate.
 Some definitions for clarity:
fragmentX is the fragment on tabX. 
fragmentX visibility refers to the state of the actual fragment, rather than the state of
the containing tab.  So if fragment1 is visible, it means it's visible when tab1 is active...
and I am considering it visible when tab2 is active, even though the entire tab1 is invisible.

1) If "alwaysSubmit" is false and fragment1 is invisible, you will get the correct behavior
regardless of tab1/tab2 visibility
2) If "alwaysSubmit" is false and fragment1 is visible, you will get the correct behavior
iff tab1 is active.  If tab2 is active, fragment1's fields will not be submitted.
3) If "alwaysSubmit" is true and fragment1 is invisible, you will get incorrect behavior (well,
technically, it's "correct": the information will be submitted, as per alwaysSubmit, but this
is a case where you don't actually /want/ the information submitted if the fragment isn't
4) If "alwaysSubmit" is true and fragment is visible, you will get correct behavior.

You can conditionally "alwaysSubmit": alwaysSubmit on the same condition for visibility as
the "visible" trigger.  The problem here comes in the following scenario:
User opens a page with fragment1 initially visible, but no data yet in the required field.
 User marks fragment1 as invisible. User submits the form.  The submission will fail because
"alwaysSubmit" was true at the time the form rendered.

The culprit behind this is Tapestry's "isDeepVisible" method.  It searches for visibility
up to the point where it finds a form element.  But in the case above, the form element contains
the tab divs, so the fragment is determined to be invisible and the data not submitted for
the inactive tab, even if the user clicked on the trigger to make the fragment visible while
the tab was active.

This is something of an edge case, but I think it can be handled cleanly by introducing a
new parameter to formfragment, such as "visiblebound" (but better named!).  The idea is to
allow developers to specify an element or selector expression that bounds the search for visibility.
 The default would be the containing form element which would preserve the current behavior.

This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message