- I m back :P I ve just revisited the select menu deal and have a couple questions. I notice that you set the label for the button menu in the constructor on theMessage 1 of 8 , Nov 1, 2008View SourceI'm back :P
I've just revisited the select menu deal and have a couple questions.
I notice that you set the label for the button menu in the constructor
on the first example. (I'll focus on the first example for this entire
I've checked a few things out, and without that label there, there
won't be any text on the button, just on the menu. Not a problem yet. ;)
I've checked the "selectedMenuItem" config using this code here:
As soon as the menu button is rendered, this is NULL. Clicking on the
button to display the menu, but without clicking on any of the menu
items, it's still NULL. After clicking a menu item, it then shows the
selected menu item.
I did see the form does submit the default selected item though, which
The next step for me is to be able to detect, programatically, which
menu item is selected. I suppose I could get all the option elements
and check each one for the selected item, but I'm assuming YUI Button
is already doing this, else it wouldn't know which menu item was selected.
I'm not sure where that data is stored though, since
"selectedMenuItem" just doesn't seem to contain the data, until a menu
item is actually clicked on.
I've taken the example from the previous post, and stripped it down to
just one select button menu. The form does submit, and the default
menu item is passed in the form.
I've got a button on there that lets me check the "selectedMenuItem"
at any time, and I put a button in there that does:
"YAHOO.widget.Button.addHiddenFieldsToForm" that. I figured that using
that, then checking the "selectedMenuItem" might show me the default.
Didn't work lol.
The page I have this example posted on is:
Thanks for checking it out :D
- To provide a very late answer to your question: Yes, both render event handlers are called.Message 2 of 8 , Dec 9, 2008View SourceTo provide a very late answer to your question: Yes, both render event handlers are called.On Oct 11, 2008, at 10:54 AM, D. Wayne Fincher wrote:
- No worries :) I see you ve been very busy here hehe Thanks for the help!Message 3 of 8 , Dec 10, 2008View SourceNo worries :) I see you've been very busy here hehe
Thanks for the help!
> To provide a very late answer to your question: Yes, both render
> event handlers are called.
> On Oct 11, 2008, at 10:54 AM, D. Wayne Fincher wrote:
> > Hi Todd Kloots,
> > You sir are a genius! And again, the folks at YUI go above and beyond
> > and set the bar even higher. That example will help out tremendously.
> > Rest assured that some of that code will make it's way into my scripts
> > very soon. It all makes sense (except for one question I have), so I
> > have no doubt I won't have any trouble getting it installed.
> > Question: For the third button "oMenuButton3", you subscribe to the
> > render event and add a listener to the submit event. If the form is
> > submitted before the menu is rendered, I see that the submit event
> > handler registers a second render event handler. ---- Do both render
> > event handlers still handle the render event at that point? It seems
> > like it would because the first render handler sets the
> > selectedMenuItem, and the second render handler submits the form, but
> > I am not 100% sure it works that way. ----
> > I like how you went through every combination of pre existing html/no
> > pre existing html, lazy load/no lazy load, and selected item/no
> > selected item!
> > /me bows before the great Todd Kloots
> > ;)
> > >
> > > D. Wayne & Walter -
> > >
> > > Todd Kloots here, author of the YUI Button widget. I wanted to
> > follow
> > > up with you both regarding using the YUI Button of type "menu" as a
> > > replacement for a <SELECT> element.
> > >
> > > As of YUI 2.6.0, when building a Button of type "menu" whose Menu is
> > > based on a <SELECT>, you can set the Button's default selected
> > item by
> > > using the "selected" attribute of the <SELECT>.
> > >
> > > I created an example for you both:
> > > http://yuiblog.com/sandbox/yui/v260/examples/button/example01.php
> > >
> > > This example covers all of the various ways to use a Button of type
> > > "menu" to replace a <SELECT> element, and how to set a default
> > value in
> > > each scenario. I wrote a lot of comments to explain things, so be
> > sure
> > > to view the source.