Title: connecting forms
Last modified: February 2, 2017

---

# connecting forms

 *  Resolved [Damn!](https://wordpress.org/support/users/greedymind/)
 * (@greedymind)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/connecting-forms-2/)
 * How do I show a particular field in form 2 based on a radio button selection 
   in form 1?
 * for example: I need to show kilograms field in form 2 if the user selects kilograms(
   radio button) in form 1.

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

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/connecting-forms-2/#post-8729455)
 * Hello,
 * The use of dependencies is not possible in this case, because the dependencies
   are applied only between fields in the same form, however, there are alternatives.
 * For example, you can assign class names to the fields in the first and second
   forms that must be unique in the webpage, for example: my-field-in-the-first-
   form, and my-field-in-the-second-form
 * and then in the second form insert a “HTML Content” field with a piece of code
   similar to the following one:
 *     ```
       <script>
       jQuery(document).on('change', '.my-field-in-the-first-form input', function(){
       if(jQuery(this).val() == 'the value to compare')
       {
       jQuery('.my-field-in-the-second-form').show().find('input,textarea,select').removeClass('ignore');
       }
       else
       {
       jQuery('.my-field-in-the-second-form').hide().find('input,textarea,select').addClass('ignore');
       }
       });
       </script>
       ```
   
 * Of course, you should adjust this solution to your project.
 * Best regards.
 *  Thread Starter [Damn!](https://wordpress.org/support/users/greedymind/)
 * (@greedymind)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/connecting-forms-2/#post-8729806)
 * Hello again,
 * The above code doesn’t seem to be working properly for me.
 *     ```
       <script>
       jQuery(document).on('change', '.my-unit-dropdown', function(){
       if(jQuery(this).val() == 'Metric')
       {
       jQuery('.my-auxiliary-kg-field').show().find('input,textarea,select').removeClass('ignore');
       jQuery('.my-auxiliary-kg-field-goal').show().find('input,textarea,select').removeClass('ignore');
       jQuery('.my-auxiliary-lbs-field').hide().find('input,textarea,select').addClass('ignore');
       jQuery('.my-auxiliary-lbs-field-goal').hide().find('input,textarea,select').addClass('ignore');
       }
       else
       {
       jQuery('.my-auxiliary-lbs-field').show().find('input,textarea,select').removeClass('ignore');
       jQuery('.my-auxiliary-lbs-field-goal').show().find('input,textarea,select').removeClass('ignore');
       jQuery('.my-auxiliary-kg-field').hide().find('input,textarea,select').addClass('ignore');
       jQuery('.my-auxiliary-kg-field-goal').hide().find('input,textarea,select').addClass('ignore');
       }
       });
       </script>
       ```
   
 * I tried to display two **kg **fields and hide the **lbs **fields when the dropdown(
   present in form 1) value is **metric ** and vice versa.
    -  This reply was modified 9 years, 4 months ago by [Damn!](https://wordpress.org/support/users/greedymind/).
    -  This reply was modified 9 years, 4 months ago by [Damn!](https://wordpress.org/support/users/greedymind/).
 *  Thread Starter [Damn!](https://wordpress.org/support/users/greedymind/)
 * (@greedymind)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/connecting-forms-2/#post-8729868)
 * Hello again,
 * The above code works only when you change the value in the drop down field and
   that too not properly. What I mean is when the page loads and the default value
   of drop is **metric **the code doesn’t work and once you change the value to **
   imperial**, the code works and now once again when you change the dropdown value
   back to **metric**, it doesn’t bring back the respective **kg **fields.
 * thanks
 * Here’s the sample page with 2 forms present: [http://damnripped.com/test/](http://damnripped.com/test/)
    -  This reply was modified 9 years, 4 months ago by [Damn!](https://wordpress.org/support/users/greedymind/).
    -  This reply was modified 9 years, 4 months ago by [Damn!](https://wordpress.org/support/users/greedymind/).
    -  This reply was modified 9 years, 4 months ago by [Damn!](https://wordpress.org/support/users/greedymind/).
 *  [mart08812](https://wordpress.org/support/users/mart08812/)
 * (@mart08812)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/connecting-forms-2/#post-8730055)
 * Hello, can this code work to retrieve data from a specific user who entered data
   into the first form?
    thnx
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/connecting-forms-2/#post-8730366)
 * Hello [@greedymind](https://wordpress.org/support/users/greedymind/),
 * You simply should trigger an onchange event before closing the script tag, and
   after the webpage is loaded:
 *     ```
       ....
       jQuery(window).on('load', function(){
       jQuery('.my-unit-dropdown input').change();
       });
       </script>
       ```
   
 * By the way, you are not defining the events correctly, you have defined the event
   for the ‘.my-unit-dropdown’ class, but the event should be applied to the input
   field whose parent has assigned the class: ‘.my-unit-dropdown’
 * `Query(document).on('change', '.my-unit-dropdown input', function(){`
 * Best regards.
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/connecting-forms-2/#post-8730382)
 * Hello [@mart08812](https://wordpress.org/support/users/mart08812/),
 * I’ll respond to question in your other support thread.
 * Best regards.
 *  Thread Starter [Damn!](https://wordpress.org/support/users/greedymind/)
 * (@greedymind)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/connecting-forms-2/#post-8730410)
 * I’m sorry, but still it doesn’t seem to be working.
 *     ```
       <script>
       jQuery(document).on('change', '.my-unit-dropdown input', function(){
       if(jQuery(this).val() == 'Metric')
       {
       jQuery('.my-auxiliary-kg-field').show().find('input,textarea,select').removeClass('ignore');
       jQuery('.my-auxiliary-kg-field-goal').show().find('input,textarea,select').removeClass('ignore');
       jQuery('.my-auxiliary-lbs-field').hide().find('input,textarea,select').addClass('ignore');
       jQuery('.my-auxiliary-lbs-field-goal').hide().find('input,textarea,select').addClass('ignore');
       }
       else
       {
       jQuery('.my-auxiliary-lbs-field').show().find('input,textarea,select').removeClass('ignore');
       jQuery('.my-auxiliary-lbs-field-goal').show().find('input,textarea,select').removeClass('ignore');
       jQuery('.my-auxiliary-kg-field').hide().find('input,textarea,select').addClass('ignore');
       jQuery('.my-auxiliary-kg-field-goal').hide().find('input,textarea,select').addClass('ignore');
       }
       });
       jQuery(window).on('load', function(){
       jQuery('.my-unit-dropdown input').change();
       });
       </script>
       ```
   
 * thanks.
    -  This reply was modified 9 years, 4 months ago by [Damn!](https://wordpress.org/support/users/greedymind/).
    -  This reply was modified 9 years, 4 months ago by [Damn!](https://wordpress.org/support/users/greedymind/).
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/connecting-forms-2/#post-8730622)
 * Hello,
 * My apologies, I had not identified that the field is DropDown, so, the tag is
   a “select” and not an “input”. The code would be:
 *     ```
       <script>
       jQuery(document).on('change', '.my-unit-dropdown select', function(){
       if(jQuery(this).val() == 'Metric')
       {
       jQuery('.my-auxiliary-kg-field').show().find('input,textarea,select').removeClass('ignore');
       jQuery('.my-auxiliary-kg-field-goal').show().find('input,textarea,select').removeClass('ignore');
       jQuery('.my-auxiliary-lbs-field').hide().find('input,textarea,select').addClass('ignore');
       jQuery('.my-auxiliary-lbs-field-goal').hide().find('input,textarea,select').addClass('ignore');
       }
       else
       {
       jQuery('.my-auxiliary-lbs-field').show().find('input,textarea,select').removeClass('ignore');
       jQuery('.my-auxiliary-lbs-field-goal').show().find('input,textarea,select').removeClass('ignore');
       jQuery('.my-auxiliary-kg-field').hide().find('input,textarea,select').addClass('ignore');
       jQuery('.my-auxiliary-kg-field-goal').hide().find('input,textarea,select').addClass('ignore');
       }
       });
       jQuery(window).on('load', function(){
       jQuery('.my-unit-dropdown select').change();
       });
       </script>
       ```
   
 * Best regards.
 *  Thread Starter [Damn!](https://wordpress.org/support/users/greedymind/)
 * (@greedymind)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/connecting-forms-2/#post-8732932)
 * thanks a lot. it works now

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

The topic ‘connecting forms’ 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/)

## Tags

 * [calculated field](https://wordpress.org/support/topic-tag/calculated-field/)
 * [radio buttons](https://wordpress.org/support/topic-tag/radio-buttons/)

 * 9 replies
 * 3 participants
 * Last reply from: [Damn!](https://wordpress.org/support/users/greedymind/)
 * Last activity: [9 years, 4 months ago](https://wordpress.org/support/topic/connecting-forms-2/#post-8732932)
 * Status: resolved