I’m trying to add a touch of class to some pop-up menus by including greyed-out, non-selectable section headers. See the “Go to action…” menu at www.freewayactions.com to see what I mean. Does anyone know how to do this? I can’t seem to find any info on it. Many thanks!
The exact tag is an optgroup, but I don’t know how Tim added it to
his site. Knowing him, it probably involved the use of an Action. If
I were going to write such a thing to use in Freeway, I would
probably force you to use a special character like an underscore as
the first letter of the option label or value, and then key off of
that to create the groups.
Here’s the example from the w3schools site:
<select>
<optgroup label="Swedish Cars">
<option value ="volvo">Volvo</option>
<option value ="saab">Saab</option>
</optgroup>
<optgroup label="German Cars">
<option value ="mercedes">Mercedes</option>
<option value ="audi">Audi</option>
</optgroup>
</select>
So if I had written such an Action, you would lay this menu out in
Freeway like this:
_Swedish Cars
Volvo
Saab
_German Cars
Mercedes
Audi
and then the Action would create the groups out of the underscored
elements.
Perhaps Tim has already written something for this. If not, I’ll take
a whack at it.
Walter
On Jun 24, 2008, at 8:30 AM, derekzinger wrote:
I’m trying to add a touch of class to some pop-up menus by
including greyed-out, non-selectable section headers. See the “Go
to action…” menu at www.freewayactions.com to see what I mean.
Does anyone know how to do this? I can’t seem to find any info on
it. Many thanks!
Thanks for the explanation, Walter. Using what you’ve said, and my recent discovery of the Source Code Snooper action, I’ve made those changes directly to the source code. There was so little involved that even my feeble knowledge of coding was enough to figure it out!
Apologies for the late reply on this. The jump menu at FreewayActions.com is created dynamically using a PHP include based on the available actions and their associated groups. I did create an action to do this back n FW 3 although I haven’t used it for a while. I’ll see if I can dig it out from my archive and if it still works.
Regards,
Tim.
On 24 Jun 2008, at 07:09, Walter Lee Davis wrote:
The exact tag is an optgroup, but I don’t know how Tim added it to
his site. Knowing him, it probably involved the use of an Action. If
I were going to write such a thing to use in Freeway, I would
probably force you to use a special character like an underscore as
the first letter of the option label or value, and then key off of
that to create the groups.
So if I had written such an Action, you would lay this menu out in
Freeway like this:
_Swedish Cars
Volvo
Saab
_German Cars
Mercedes
Audi
and then the Action would create the groups out of the underscored
elements.
Perhaps Tim has already written something for this. If not, I’ll take
a whack at it.
Walter
On Jun 24, 2008, at 8:30 AM, derekzinger wrote:
I’m trying to add a touch of class to some pop-up menus by
including greyed-out, non-selectable section headers. See the “Go
to action…” menu at www.freewayactions.com to see what I mean.
Does anyone know how to do this? I can’t seem to find any info on
it. Many thanks!
Well I ended up rewriting the action as the original version allowed you to nest the option groups which causes the code to fail validation. The action code also needed a bit of a spruce up so I took Walter’s suggestion and simply made the action look for menu/list choices that start with an underscore.
So for example:
Choice:_Swedish Cars
Value: anything (or nothing) - the value is ignored
For the moment the action code is up on Pastie.org at; http://pastie.org/224593
If you have any problems with it just shout and I’ll take a closer look.
Regards,
Tim.
On 29 Jun 2008, at 11:22, derekzinger wrote:
Thanks, Tim. Would love to see the action if you manage to dig it up.
FreewayActions.com - Freeware and shareware actions for Freeway Express & Pro.
Protect your mailto links from being harvested by spambots with Anti Spam.
Only available at FreewayActions.com
I’ll try and get a page up on FreewayActions.com later this week but for now
here’s a quick overview of the action and how to use it;
Add a standard menu/list to your page using the Menu/List menu item from the
Insert menu.
The inspector palette for the item allows you to set both Choice and Value
entries for each item in the menu/list.
Add as many items as you need and then start adding the section names. You
can do this by adding an underscore to the start of the Choice entry. The Value
field is ignored and can be left blank.
For example:
Choice:_Fruit
Value: (blank)
Finally add the action to the menu/list by selecting the action name from the
Item/Actions menu item.
When the page is published the action loops through the menu/list options
looking for the underscore markers and uses the data to construct the option
groups.
Things to watch out for;
Using the Freeway interface it is possible to make an entry that is going to be
converted into an option group label a default value for the menu/list. Because
the action destroys these items the default setting also gets destroyed. As such
you should avoid setting the default status to anything starting with an
underscore.
If there is anything here that doesn’t make sense just ask.
Regards,
Tim.
Where did you have in mind?
The action adds option groups to the menu/list options and AFAIK these are the
only places these can be legitimately used.
There are a few things like this that Freeway doesn’t handle that I’d like to
see added to Freeway Pro at some point in the future.
Fieldsets and Legends are two others
(http://www.w3.org/TR/html401/interact/forms.html#h-17.10).
Although the action does the job you have to know how it works and it really is
a bit of a hack at the end of the day.
Regards,
Tim.
Well, the not allowing selecting part is incidental to the role that
this tag plays. It’s meant semantically as a category header for the
elements that follow it.
If you want a form field to be unselectable, you can add
disabled=“disabled” to it. I imagine that this would apply to a
select option, but Freeway doesn’t offer you the chance to add that
tag to an option, you would need to use Source Code Snooper for that.
Walter
On Jun 30, 2008, at 7:49 PM, DeltaDave wrote:
Nowhere specific - I was just thinking that there must be other
places that would benefit from this sort of effect, that of not
allowing selection.