views:

204

answers:

1

So i have a set of checkbox buttons generate using YUI markup and javascript.

They have a function listening for an onclick event.

  var onFacetClick = function (e) { // e is the event
 console.log(e);
 alert(this.get('value'));
 alert(this.get('checked'));
 submitForm();
    };

When I click on the checkbox the function gets called, I get alerted of the value and checked is true for the event object. However these don't seem to get passed in the form.

My code that deals with the form shows that the parameter for these check boxes is null.

If I have a separate submit button everything works fine. But I want the onclick to submit the form and have this checkbox checked in the form.

A: 

And I've finally got this one working too.

I needed to add YAHOO.widget.Button.addHiddenFieldsToForm(advancedSearchForm); to my function:

    var onFacetClick = function (e) { // e is the event
       var advancedSearchForm = YAHOO.util.Dom.get('advancedsearch');
       YAHOO.widget.Button.addHiddenFieldsToForm(advancedSearchForm);
       advancedSearchForm.submit();
   };

See the known issues on YUI Button, Known Issues

Simon