Here’s another cool trick I just came up with. I had a main menu encased in a fieldset with a title in a legend, and I wanted to move the menu to some other pages so people would have a handy main menu on every page. It’s a bit bulky, so knew I needed to hide it, so the switch/case was just what I needed. Then I thought, hey, wouldn’t it be cool if I could just click on the legend and have the menu drop out? Well, here it is folks!
Shut:
Open:
And here’s the code (sorry I don’t have time to tidy it up):
(see also Switch/Case Toggle Template or Using Switch Case as a drop down box).
<xf:switch>
<xf:case id=’menuShut’>
<h:fieldset style=”background-color:#cccc99;
width:24ex; padding-left:3ex; border-width:1px; border-color:#000033;”>
<h:legend >
<xf:trigger appearance=’minimal’>
<h:span style=”color:#800000;font-weight:bold;font-size:107%”>
<xf:label> Main Menu </xf:label>
</h:span>
<xf:toggle case=’menuOpen’ ev:event=’DOMActivate’/></xf:trigger>
</h:legend>
</h:fieldset>
</xf:case>
<xf:case id=’menuOpen’>
<h:fieldset style=”background-color:#cccc99;
width:24ex; padding:3ex; border-width:1px; border-color:#000033;”>
<h:legend >
<xf:trigger appearance=’minimal’>
<h:span style=”color:#800000;font-weight:bold;font-size:107%”>
<xf:label> Main Menu </xf:label>
</h:span>
<xf:toggle case=’menuShut’ ev:event=’DOMActivate’/></xf:trigger>
</h:legend>
<xf:submit id=”optionsMenu” class=”ztagsbox” submission=”optionsMenu” appearance=”minimal”>
<xf:label class=”ssubmit”>
<h:fieldset class=”barmenu”>
Make a new form
</h:fieldset>
</xf:label>
</xf:submit>
<h:br/>
<xf:submit id=”fileManager” class=”ztagsbox” submission=”fileManager” appearance=”minimal”>
<xf:label class=”ssubmit”>
<h:fieldset class=”barmenu”>
View or Delete forms
</h:fieldset>
</xf:label>
</xf:submit>
<h:br/>
<xf:submit id=”styling” class=”ztagsbox” submission=”styling” appearance=”minimal”>
<xf:label class=”ssubmit”>
<h:fieldset class=”barmenu”>
Style forms
</h:fieldset>
</xf:label>
</xf:submit>
<h:br/>
<xf:submit id=”stats” class=”ztagsbox” submission=”stats” appearance=”minimal”>
<xf:label class=”ssubmit”>
<h:fieldset class=”barmenu”>
Work with Data
</h:fieldset>
</xf:label>
</xf:submit>
<h:br/>
<xf:submit id=”clients” class=”ztagsbox” submission=”clients” appearance=”minimal”>
<xf:label class=”ssubmit”>
<h:fieldset class=”barmenu”>
Clients
</h:fieldset>
</xf:label>
</xf:submit>
</h:fieldset>
</xf:case></xf:switch>


Hi,
Out of interest, why do you put spans around labels, and fieldsets inside them? Everything you have done here could be done with XForms only, which means that it could be reused in any XForms processor, regardless of whether it runs in XHTML, SVG, or something else.
Just a thought.
All the best,
Mark
–
Mark Birbeck, formsPlayer
mark.birbeck@formsPlayer.com | +44 (0) 20 7689 9232
http://www.formsPlayer.com | http://internet-apps.blogspot.com
standards. innovation.
Comment by Mark Birbeck — September 5, 2007 @ 10:49 am
Thanks Mark for your comments. That’s what I hope to get is some feedback on the way I do things.
I’d be glad for you to show me.
As for your question, that’s easy to answer—- I don’t know how.
On the other hand, I think that Xforms really is the future and that we all better get used to it in one way or another, and I hope to show others that you don’t have to be an expert to start using it. As I said in my initial post, I know that there are other and better ways of doing the things I do–I’d love to see them. But again, even if clumsily, I just finished a fairly sophistacated application using nothing but Xhtml+Xforms and PHP, and I consider myself just a step above an amateur–that makes Xforms a pretty powerful tool.
I know all you guys are busy — but if you do ever have a chance to post a better way — or direct me to an example– please, that would make me very happy.
Comment by clarkepeters — September 5, 2007 @ 11:27 pm
[...] a different note, if your interested how I got the “legend” look on a switch/case, see Xforms: The Legendary Toggle [...]
Pingback by Drop Down over/above lower text (Xforms Switch and CSS) « Clarkepeters’s Weblog — September 13, 2007 @ 1:14 pm
[...] my post Xforms: The Legendary Toggle I use two cases with the Switch/Case method to get the effect I wanted–inside the cases are [...]
Pingback by A better Legendary Toggle « Clarkepeters’s Weblog — October 9, 2007 @ 8:51 pm
[...] legend at all (see Switch/Case Toggle Template or Using Switch Case as a drop down box). In my post Xforms: The Legendary Toggle I use two cases with the Switch/Case method to get the effect I wanted–inside the cases are [...]
Pingback by ClarkePeter’s Weblog » A better Legendary Toggle — October 20, 2008 @ 7:20 pm