Title: Hidden Elements
Last modified: August 22, 2016

---

# Hidden Elements

 *  Resolved [trev.pope](https://wordpress.org/support/users/trevpope/)
 * (@trevpope)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/hidden-elements/)
 * Hi David,
 * When I use Hidden elements and then try and preview the form I am getting a script
   error, the Hidden element has an ID of say fld_754703, but then when I try and
   use the hidden element in a calculation I get a script error stating ‘Uncaught
   ReferenceError: fld_754703_1_1 is not defined’.
 * Any chance you could help?
 * Kind regards
 * Trevor
 * [https://wordpress.org/plugins/caldera-forms/](https://wordpress.org/plugins/caldera-forms/)

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

 *  Thread Starter [trev.pope](https://wordpress.org/support/users/trevpope/)
 * (@trevpope)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/hidden-elements/#post-5171754)
 * Some extra information to go on, this is the line where the error is occuring:
 * `
    var fld_8054423_1 = parseFloat( $(‘[data-field=”fld_8054423_1″]’).is(‘:checkbox’)?
   checked_total_fld_2628740_1($(‘[data-field=”fld_8054423_1″]:checked’)) : $(‘[
   data-field=”fld_8054423_1″]’).is(‘:radio’) ? $(‘[data-field=”fld_8054423_1″]:
   checked’).val() : $(‘[data-field=”fld_8054423_1″]’).val() ) || 0 , fld_6702947_1
   = parseFloat( $(‘[data-field=”fld_6702947_1″]’).is(‘:checkbox’) ? checked_total_fld_2628740_1(
   $(‘[data-field=”fld_6702947_1″]:checked’)) : $(‘[data-field=”fld_6702947_1″]’).
   is(‘:radio’) ? $(‘[data-field=”fld_6702947_1″]:checked’).val() : $(‘[data-field
   =”fld_6702947_1″]’).val() ) || 0 , total = (fld_8054423_1_1*fld_6702947_1_1);‘
 * Notice that the field is referred as fld_8054423_1 when it is referenced in the
   parseFloat function but when utilised in the total section at the end it is trying
   to find fld_8054423_1_1 which doesn’t exist.
 * This is a very simple form with one slider, a drop down select and a hidden field
   with a total that works on the two elements.
 * Cheers David.
 *  Thread Starter [trev.pope](https://wordpress.org/support/users/trevpope/)
 * (@trevpope)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/hidden-elements/#post-5171758)
 * Hi David,
 * Thought it may help to have the whole Javascript function that is failing to 
   see what is going on:
 *     ```
       <script type="text/javascript">
       	jQuery(function($){
       		function checked_total_fld_2628740_1(items){
       			var sum = 0;
       			items.each(function(k,v){
       				sum += parseFloat($(v).val());
       			})
       			return sum;
       		}
       		function docalc_fld_2628740_1(){
       			var fld_8054423_1 = parseFloat( $('[data-field="fld_8054423_1"]').is(':checkbox') ? checked_total_fld_2628740_1($('[data-field="fld_8054423_1"]:checked')) : $('[data-field="fld_8054423_1"]').is(':radio') ? $('[data-field="fld_8054423_1"]:checked').val() : $('[data-field="fld_8054423_1"]').val() ) || 0 , fld_6702947_1 = parseFloat( $('[data-field="fld_6702947_1"]').is(':checkbox') ? checked_total_fld_2628740_1($('[data-field="fld_6702947_1"]:checked')) : $('[data-field="fld_6702947_1"]').is(':radio') ? $('[data-field="fld_6702947_1"]:checked').val() : $('[data-field="fld_6702947_1"]').val() ) || 0 ,
       				total = (fld_8054423_1_1*fld_6702947_1_1);
   
       						total = total.toFixed(2);
   
       			$('#fld_2628740_1').html( total );
       			$('[data-field="fld_2628740_1"]').val( total ).trigger('change');
   
       		}
       		$('body').on('change keyup cf.remove cf.add', '[data-field="fld_8054423_1"],[data-field="fld_6702947_1"],#conditional_fld_8054423_1,#conditional_fld_6702947_1', function(e){
       			docalc_fld_2628740_1();
       		});
       		docalc_fld_2628740_1();
       	});
   
       </script>
       ```
   
 *  Plugin Contributor [David Cramer](https://wordpress.org/support/users/desertsnowman/)
 * (@desertsnowman)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/hidden-elements/#post-5171781)
 * Thanks for that – I’ll take a look in a moment.
 *  Thread Starter [trev.pope](https://wordpress.org/support/users/trevpope/)
 * (@trevpope)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/hidden-elements/#post-5171793)
 * Cheers David, ignore my title for this thread as the example I have given doesn’t
   use hidden elements.
 * All I have is a slider, a drop down box and a total field, the total should be
   a multiplication of the two but cannot get it to work.
 *  Thread Starter [trev.pope](https://wordpress.org/support/users/trevpope/)
 * (@trevpope)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/hidden-elements/#post-5171808)
 * One last thing, the error above is based on me doing a manual formula. If I deselect
   the manual formula and use your point and click selection of the two fields it
   then works as expected.
 *  Plugin Contributor [David Cramer](https://wordpress.org/support/users/desertsnowman/)
 * (@desertsnowman)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/hidden-elements/#post-5171813)
 * OH wow- thanks that explains a lot.
 * I’ll make a fix and sort it out. thanks.
 *  Thread Starter [trev.pope](https://wordpress.org/support/users/trevpope/)
 * (@trevpope)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/hidden-elements/#post-5171817)
 * Do you think there is any possibility that you may be able to get the fix out
   before Sunday David?
 *  Plugin Contributor [David Cramer](https://wordpress.org/support/users/desertsnowman/)
 * (@desertsnowman)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/hidden-elements/#post-5171862)
 * I have fixed it on the GitHub version which you can download here- [https://github.com/Desertsnowman/Caldera-Forms](https://github.com/Desertsnowman/Caldera-Forms)
 * I have a few more little issue I need to solve before I release a full update
   here. Not sure it will be before sunday.

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

The topic ‘Hidden Elements’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/caldera-forms_475846.svg)
 * [Caldera Forms - More Than Contact Forms](https://wordpress.org/plugins/caldera-forms/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/caldera-forms/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/caldera-forms/)
 * [Active Topics](https://wordpress.org/support/plugin/caldera-forms/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/caldera-forms/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/caldera-forms/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [David Cramer](https://wordpress.org/support/users/desertsnowman/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/hidden-elements/#post-5171862)
 * Status: resolved