views:

1464

answers:

2

(I've tried posting this on YUI message group but without any luck)

Can anyone tell me how to retrieve the checked state of a yui Button? I've tried by creating the Button in code, which is then outputted as a HTML button but this only changes the title attribute.

When I use checkboxes instead, none of the checkboxes are checked (when iterating through them with jQuery).

Is there an easier way of doing it? Say with the 3.0 Node API, or Element?

EDIT: To clarify how this problem came about, I'm using the YUI ASP.NET controls. They add controls to the page like this

Sys.Application.add_init(function() {    $create(YUIAspNet.Button, {"ButtonID":"yuiMyButton_btn","ButtonName":"yuiMyButton$btn","TabIndex":0,"ButtonType":"checkbox","Text":"Technology"}, null, null, $get("yuiMyButton"));});

So as you can see, finding all buttons is not as simple as I'd like it to have been.

+3  A: 

Sorry are you talking about checkbox buttons? Use:

myButton.get("checked")

where myButton is an instance of YAHOO.widget.Button.

Crescent Fresh
Thanks, my fault for not checking the landing page for Button (http://developer.yahoo.com/yui/button/)
Chris S
A: 

Chris, I am the starter of YUI ASP.NET project. I watch the YUI mailing list regularly, I must of missed your question.

I have a more general answer for you and anyone else having the problem and ending up reading this, not just for checkbox button, but for all controls.

On the client, you can have access to the YUI object by calling the .get_YUIControl() method on the custom wrapper client object, then you have the control over the original YUI object. The YUI documentation is very good, and you can find a good description for what you'd like to accomplish.