Details
-
Type: Improvement
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 2.0-Alpha3
-
Component/s: ICE-Components
-
Labels:None
-
Environment:Sparkle Tab component
-
Affects:Documentation (User Guide, Ref. Guide, etc.), Sample App./Tutorial
Description
Currently, the Sparkle Tab component can be used in one of two ways:
1. Entire tab component and all tab panes, and their children, contained in a single form. This is consistent with the ICEfaces 1.x panelTab component.
2. Tab component itself is not contained in a form at all, and each tab panel can use a form to wrap components it contains as required.
However, this mechanism requires the use of the so-called "formless" submit feature that was originally part of early Glimmer core.This notion of components not requiring a form is no longer seen as desirable, certainly, at least, the tab should not require it's use.
Instead, the tab should be refactored such that the tab control itself can reside in one form, while the tab panes may each reside in forms of their own (or contain forms of their own). One way this could be achieved is if the tabPanes are not specified within a Tab component tag (heriarchical), but instead, use a "for=xxx" attribute to specify the tab control that they are associated with. Using this approach, the tab-control can be placed in one form and each tab pane can be placed in another, or all tab panes in one form and the tab control in another, or all in one form, etc.
1. Entire tab component and all tab panes, and their children, contained in a single form. This is consistent with the ICEfaces 1.x panelTab component.
2. Tab component itself is not contained in a form at all, and each tab panel can use a form to wrap components it contains as required.
However, this mechanism requires the use of the so-called "formless" submit feature that was originally part of early Glimmer core.This notion of components not requiring a form is no longer seen as desirable, certainly, at least, the tab should not require it's use.
Instead, the tab should be refactored such that the tab control itself can reside in one form, while the tab panes may each reside in forms of their own (or contain forms of their own). One way this could be achieved is if the tabPanes are not specified within a Tab component tag (heriarchical), but instead, use a "for=xxx" attribute to specify the tab control that they are associated with. Using this approach, the tab-control can be placed in one form and each tab pane can be placed in another, or all tab panes in one form and the tab control in another, or all in one form, etc.
The YUI tab set requires following HTML markup structure to be present.
<div id="demo" class="yui-navset">
<ul>
<li><a href="#tab1"><em>Tab One Label</em></a></li>
<li><a href="#tab2"><em>Tab Two Label</em></a></li>
<li><a href="#tab3"><em>Tab Three Label</em></a></li>
</ul>
<div class="yui-content">
<div><p>Tab One Content</p></div>
<div><p>Tab Two Content</p></div>
<div><p>Tab Three Content</p></div>
</div>
</div>
Currently Sparkle tabset jsp looks something like this:
<h:form>
<ann:tabset id="myTabSet">
<ann:tab>
<h:input required="true"/>
</ann:tab>
<ann:tab>
<h:input required="true"/>
</ann:tab>
</ann:tabset>
</h:form>
And tabset render renders the following markup. Pretty straight forward.
<form>
<div id="demo" class="yui-navset">
<ul class="yui-nav">
<li><a href="#tab2"><em>Tab Two Label</em></a></li>
<li><a href="#tab3"><em>Tab Three Label</em></a></li>
</ul>
<div class="yui-content">
<div><input type="text"/></div>
<div><input type="text"/></div>
</div>
</div>
<form>
But to support tabset and tab component using "for" notation. I am puzzled about how we are going to render the markup so we can put tabset and tabs in different forms as well as conform with the YUI required markup.
Let see how the JSP markup will look like with "for" attribute.
//The Tabset component in its own form
<h:form>
<ann:tabset id="myTabSet"/>
< some_other_components />
</h:form>
//The tab component in its own form
<h:form>
<ann:tab id="tabOne" for="myTabSet">
<h:input required="true"/>
</ann:tab>
<h:form>
//The tab component contains forms.
<ann:tab id="tabTwo" for="myTabSet">
<h:form>
<h:input required="true"/>
<h:form>
<h:form>
<h:input required="true"/>
<h:form>
</ann:tab>
So I don't see a way to renderer markup for above JSP, while also conforming the YUI markup? Any idea.
There is a property on YUI tab component, which allows you to define the element which contains contents of the tab. (e.g.)
tabOne.set('contentEl', element);
but If I use above function to reference the tab content element, YUI removes the element from its original location and append it to the tab DIV.