开发者

YUI checkbox button onclick form submission

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 开发者_JAVA百科everything works fine. But I want the onclick to submit the form and have this checkbox checked in the form.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜