PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Saving checkbox values to custom taxonomy

  1. sanz

    Hi all,

    I'm in need of a little guidance with getting and then saving selected checkbox values to a custom taxonomy.

    My form is correctly displaying terms from a custom taxonomy (retail_category) using the Gravity Forms + Custom Post Types plugin. I realise I also need to use gform_after_submission or similar action to do the actual save to the taxonomy.

    I'm just not sure how to get the values from the checkboxes into an array that I can pass directly to wp_set_object_terms.

    My form ID is 6 and the field ID is 8. The checkbox list shows up like:

    <li id="field_6_8" class="gfield    retailer-edit-profile-retail-categories"><label class="gfield_label">Retail Categories</label><div class="gfield_description">Select the Retail Categories that best describe your company products/services.</div><div class="ginput_container"><ul class="gfield_checkbox" id="input_6_8"><li class="gchoice_8_1"><input name="input_8.1" type="checkbox" value="9" checked="checked" id="choice_8_1" tabindex="15"><label for="choice_8_1">Appliances</label></li><li class="gchoice_8_2"><input name="input_8.2" type="checkbox" value="10" id="choice_8_2" tabindex="16"><label for="choice_8_2">Book Stores and Stationary</label></li><li class="gchoice_8_3"><input name="input_8.3" type="checkbox" value="8" id="choice_8_3" tabindex="17"><label for="choice_8_3">Fashion and Accessories</label></li><li class="gchoice_8_4"><input name="input_8.4" type="checkbox" value="6" id="choice_8_4" tabindex="18"><label for="choice_8_4">Food and Beverage</label></li><li class="gchoice_8_5"><input name="input_8.5" type="checkbox" value="7" id="choice_8_5" tabindex="19"><label for="choice_8_5">Home and Living</label></li><li class="gchoice_8_6"><input name="input_8.6" type="checkbox" value="15" checked="checked" id="choice_8_6" tabindex="20"><label for="choice_8_6">Technology</label></li></ul></div></li>

    Any help would be appreciated.

    Posted 12 years ago on Monday March 12, 2012 | Permalink
  2. sanz

    If anyone can show me the basics of getting the values from selected checkboxes into an array suitable for saving to a custom taxonomy that would be great. Thanks.

    Posted 12 years ago on Thursday March 15, 2012 | Permalink
  3. If you are using the Gravity Forms Custom Post Types Add-On, shouldn't you be able to use it's built in functionality to save checkbox values as taxonomy items for that custom taxonomy type? Or does the Custom Post Types Add-On not work with the checkbox field?

    Posted 12 years ago on Tuesday March 20, 2012 | Permalink
  4. It doesn't work with the checkbox field... only the input field.

    I'm needing this function too right now and am working on a fix.

    Posted 11 years ago on Thursday August 16, 2012 | Permalink
  5. Please let us know what you come up with. I'm sure it will be useful to others. Thank you.

    Posted 11 years ago on Thursday August 16, 2012 | Permalink
  6. Thanks for posting that.

    Posted 11 years ago on Thursday August 16, 2012 | Permalink

This topic has been resolved and has been closed to new replies.