Checkboxes default checked attribute

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)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.