Forums Forums Search & Filter Pro Checkboxes default checked attribute

Viewing 2 posts - 1 through 2 (of 2 total)
  • Anonymous
    #54695

    Hi,
    I would like to have the checkboxes’ checked attribute automatically set to ‘checked’, when opening the form. I use the following filter function :

    function catcheck($input_object, $sfid)
    {
    if($input_object[‘attributes’][‘type’]==’checkbox’)
    {
    $input_object[‘attributes’][‘checked’]=’checked’;
    }

    return $input_object;
    }
    add_filter(‘sf_input_object_pre’, ‘catcheck’, 10, 2);

    It does not work. In my various tests, I manage to act on the

      element that contains the input elements, but not on the input elements themselves.

      Thanks for your help.

      Olivier

    Trevor
    #54701

    I think it is your code that may need to be changed. Have a read of this, there are many other threads on StackExchange like it:

    http://stackoverflow.com/questions/5270689/attrchecked-checked-does-not-work

    WordPress uses jQuery 1.12.4

Viewing 2 posts - 1 through 2 (of 2 total)