Title: hide fields in post
Last modified: February 10, 2021

---

# hide fields in post

 *  Resolved [cckarman](https://wordpress.org/support/users/cckarman/)
 * (@cckarman)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/hide-fields-in-post/)
 * I am looking your calculated fields form in a website with bread-recipes. General
   setup is the same, but depending on the recipe I want to use different (ingredient)
   fields. I use the following code to set values for the individual ingredients.
   What would be your advise if I wanted, for example, omit/hide fieldname5 from
   the form?
 * Thanks,
    Chris
 * <script>
    cpcff_default = { 1 : {} }; cpcff_default[1][ ‘fieldname6’ ] = 13; //
   aantal broden cpcff_default[1][ ‘fieldname10’ ] = 80; //deeggewicht cpcff_default[
   1][ ‘fieldname13’ ] = 63; //hydratatie cpcff_default[1][ ‘fieldname3’ ] = 0; //
   bloem cpcff_default[1][ ‘fieldname5’ ] = 0; //water cpcff_default[1][ ‘fieldname7’]
   = 0; //zout </script>
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fhide-fields-in-post%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/hide-fields-in-post/#post-14033151)
 * Hello [@cckarman](https://wordpress.org/support/users/cckarman/)
 * There are different alternatives:
 * * you can define it as dependent on another field in the form. More information
   about dependencies by reading the following post in the plugin’s blog:
 * [https://cff.dwbooster.com/blog/2020/03/01/dependencies/](https://cff.dwbooster.com/blog/2020/03/01/dependencies/)
 * * Or you can assign the class name `hide` to the field. The class names are assigned
   to the fields through their attributes: “Add CSS Layout Keywords.”.
 * Best regards.
 *  Thread Starter [cckarman](https://wordpress.org/support/users/cckarman/)
 * (@cckarman)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/hide-fields-in-post/#post-14033188)
 * Many thanks for your prompt reply! I will go and try the dependencies, need it
   anyway for some other options.
 * I have been trying to set the class name `hide` to the field, it felt like the
   most straightforward option. I know that I can add it during design to the “Add
   CSS Layout Keywords”, but how would I do that from the script that I am using
   in my post?
 * Thanks,
    Chris
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/hide-fields-in-post/#post-14033321)
 * Hello [@cckarman](https://wordpress.org/support/users/cckarman/)
 * You can assign a custom class name to the field, for example `field-a`, and then
   you can assign the class name `hide` to the field by programming with the piece
   of code similar to:
 * `jQuery('.field-a').addClass('hide');`
 * Best regards.
 *  Thread Starter [cckarman](https://wordpress.org/support/users/cckarman/)
 * (@cckarman)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/hide-fields-in-post/#post-14037094)
 * Thanks. Unfortunately, this seems not to work. I included the jQuery code between
   the <script> blocks, but it did not work. Do I need to change something in my
   settings so that it can work with jQuery in an HTML block?
 * Best, Chris
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/hide-fields-in-post/#post-14037119)
 * Hello [@cckarman](https://wordpress.org/support/users/cckarman/)
 * The code must be executed after the form is generated. Please, edit your code
   as follows:
 *     ```
       <script>
       jQuery(window).on('load', function(){
       jQuery('.field-a').addClass('hide');
       });
       </script>
       ```
   
 * Best regards.
 *  Thread Starter [cckarman](https://wordpress.org/support/users/cckarman/)
 * (@cckarman)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/hide-fields-in-post/#post-14037815)
 * Many thanks, works like a charm!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘hide fields in post’ is closed to new replies.

 * ![](https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg?rev=1734377)
 * [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/calculated-fields-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/calculated-fields-form/)
 * [Active Topics](https://wordpress.org/support/plugin/calculated-fields-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/calculated-fields-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/calculated-fields-form/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [cckarman](https://wordpress.org/support/users/cckarman/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/hide-fields-in-post/#post-14037815)
 * Status: resolved