Calculated Fields Form - Version 1.1.109

Version Description

  • Increase the number of template forms.
  • Modifies the library popup.
  • Modifies the forms generator.
  • Fixes a minor issue in the button control.
  • Makes the form name a required attribute.
  • Modifies the currentdate and submissiondate tags in the notification emails and thank you pages to accept a separator symbol between date components (Professional, Developer, and Platinum versions).
Download this release

Release Info

Developer codepeople
Plugin Icon 128x128 Calculated Fields Form
Version 1.1.109
Comparing to
See all releases

Code changes from version 1.1.108 to 1.1.109

README.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://cff.dwbooster.com
4
  Tags: form,quote form,contact form,form builder,calculator,calculated,quote calculator,forms,form editor,advanced forms,payment calculator,payment,recurring payment,quote,fields,calculated field,price calculator,email,form design,paypal,equation editor,formula,equation,quote calculator,post,posts,plugin,widget,admin,sidebar,images,image,page,shortcode,products form,woocommerce,addons,layout,session,post,cookie,get,webhook,Dropbox,pdf,language
5
  Requires at least: 3.0.5
6
  Tested up to: 6.0
7
- Stable tag: 1.1.108
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -965,6 +965,15 @@ A: Please, follow the steps below:
965
 
966
  == Changelog ==
967
 
 
 
 
 
 
 
 
 
 
968
  = 1.1.108 =
969
 
970
  * Implements the create form from the templates library module.
@@ -1011,8 +1020,4 @@ A: Please, follow the steps below:
1011
  * Removes the h2 and span tags for form title and description if they are empty.
1012
  * Fixes an issue with the collapsible fieldsets when legends are empty.
1013
  * Modifies the CSV Generator add-on to allow including the URL to the CSV files in the notification emails (Platinum version).
1014
- * Implements the Private Apps integration in the HubSpot add-on (Platinum version).
1015
-
1016
- = 1.1.99 =
1017
-
1018
- * Fixes an issue with the Select2 integration to display the choices texts instead of their values.
4
  Tags: form,quote form,contact form,form builder,calculator,calculated,quote calculator,forms,form editor,advanced forms,payment calculator,payment,recurring payment,quote,fields,calculated field,price calculator,email,form design,paypal,equation editor,formula,equation,quote calculator,post,posts,plugin,widget,admin,sidebar,images,image,page,shortcode,products form,woocommerce,addons,layout,session,post,cookie,get,webhook,Dropbox,pdf,language
5
  Requires at least: 3.0.5
6
  Tested up to: 6.0
7
+ Stable tag: 1.1.109
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
965
 
966
  == Changelog ==
967
 
968
+ = 1.1.109 =
969
+
970
+ * Increase the number of template forms.
971
+ * Modifies the library popup.
972
+ * Modifies the forms generator.
973
+ * Fixes a minor issue in the button control.
974
+ * Makes the form name a required attribute.
975
+ * Modifies the currentdate and submissiondate tags in the notification emails and thank you pages to accept a separator symbol between date components (Professional, Developer, and Platinum versions).
976
+
977
  = 1.1.108 =
978
 
979
  * Implements the create form from the templates library module.
1020
  * Removes the h2 and span tags for form title and description if they are empty.
1021
  * Fixes an issue with the collapsible fieldsets when legends are empty.
1022
  * Modifies the CSV Generator add-on to allow including the URL to the CSV files in the notification emails (Platinum version).
1023
+ * Implements the Private Apps integration in the HubSpot add-on (Platinum version).
 
 
 
 
changelog.txt CHANGED
@@ -1,5 +1,14 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
 
3
  = 1.1.108 =
4
 
5
  * Implements the create form from the templates library module.
1
  == Changelog ==
2
 
3
+ = 1.1.109 =
4
+
5
+ * Increase the number of template forms.
6
+ * Modifies the library popup.
7
+ * Modifies the forms generator.
8
+ * Fixes a minor issue in the button control.
9
+ * Makes the form name a required attribute.
10
+ * Modifies the currentdate and submissiondate tags in the notification emails and thank you pages to accept a separator symbol between date components (Professional, Developer, and Platinum versions).
11
+
12
  = 1.1.108 =
13
 
14
  * Implements the create form from the templates library module.
cp_calculatedfieldsf_free.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Calculated Fields Form
4
  Plugin URI: https://cff.dwbooster.com
5
  Description: Create forms with field values calculated based in other form field values.
6
- Version: 1.1.108
7
  Text Domain: calculated-fields-form
8
  Author: CodePeople
9
  Author URI: https://cff.dwbooster.com
@@ -16,7 +16,7 @@ if(!defined('WP_DEBUG') || true != WP_DEBUG)
16
  }
17
 
18
  // Defining main constants
19
- define('CP_CALCULATEDFIELDSF_VERSION', '1.1.108' );
20
  define('CP_CALCULATEDFIELDSF_MAIN_FILE_PATH', __FILE__ );
21
  define('CP_CALCULATEDFIELDSF_BASE_PATH', dirname( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
22
  define('CP_CALCULATEDFIELDSF_BASE_NAME', plugin_basename( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
3
  Plugin Name: Calculated Fields Form
4
  Plugin URI: https://cff.dwbooster.com
5
  Description: Create forms with field values calculated based in other form field values.
6
+ Version: 1.1.109
7
  Text Domain: calculated-fields-form
8
  Author: CodePeople
9
  Author URI: https://cff.dwbooster.com
16
  }
17
 
18
  // Defining main constants
19
+ define('CP_CALCULATEDFIELDSF_VERSION', '1.1.109' );
20
  define('CP_CALCULATEDFIELDSF_MAIN_FILE_PATH', __FILE__ );
21
  define('CP_CALCULATEDFIELDSF_BASE_PATH', dirname( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
22
  define('CP_CALCULATEDFIELDSF_BASE_NAME', plugin_basename( CP_CALCULATEDFIELDSF_MAIN_FILE_PATH ) );
css/stylelibrary.css CHANGED
@@ -10,10 +10,8 @@
10
 
11
  .cff-form-library-container{
12
  background:white;
13
- width:700px;
14
- height:700px;
15
- max-width:90%;
16
- max-height:90%;
17
  position:absolute;
18
  left:50%;
19
  top:50%;
10
 
11
  .cff-form-library-container{
12
  background:white;
13
+ width:90%;
14
+ height:90%;
 
 
15
  position:absolute;
16
  left:50%;
17
  top:50%;
inc/cpcff_admin_int_list.inc.php CHANGED
@@ -161,8 +161,15 @@ endif;
161
  var cff_metabox_nonce = '<?php print esc_js( wp_create_nonce( 'cff-metabox-status' ) ); ?>';
162
  function cp_addItem()
163
  {
164
- var calname = document.getElementById("cp_itemname").value,
 
 
165
  category = document.getElementById("calculated-fields-form-category").value;
 
 
 
 
 
166
  document.location = 'admin.php?page=cp_calculated_fields_form&a=1&r='+Math.random()+'&name='+encodeURIComponent(calname)+'&category='+encodeURIComponent(category)+'&_cpcff_nonce=<?php echo wp_create_nonce( 'cff-add-form' ); ?>';
167
  }
168
 
@@ -322,9 +329,9 @@ endif;
322
  <h3 class='hndle' style="padding:5px;"><span><?php _e( 'New Form', 'calculated-fields-form' ); ?></span></h3>
323
  <div class="inside">
324
  <form name="additem">
325
- <?php _e( 'Item Name', 'calculated-fields-form' ); ?>:<br />
326
  <div>
327
- <input type="text" name="cp_itemname" id="cp_itemname" value="" onkeyup="cp_addItem_keyup( event );" style="margin-top:5px;" />
328
  <input type="text" name="calculated-fields-form-category" id="calculated-fields-form-category" value="<?php print esc_attr($cff_current_form_category); ?>" style="margin-top:5px;" placeholder="<?php esc_attr_e('Category', 'calculated-fields-form'); ?>" list="calculated-fields-form-categories" />
329
  <datalist id="calculated-fields-form-categories">
330
  <?php
161
  var cff_metabox_nonce = '<?php print esc_js( wp_create_nonce( 'cff-metabox-status' ) ); ?>';
162
  function cp_addItem()
163
  {
164
+ var e = jQuery("#cp_itemname"),
165
+ form_tag = e.closest('form')[0],
166
+ calname = e.val().replace(/^\s*/, '').replace(/^\s*/, '').replace(/\s*$/, ''),
167
  category = document.getElementById("calculated-fields-form-category").value;
168
+
169
+ e.val(calname);
170
+
171
+ if('reportValidity' in form_tag && !form_tag.reportValidity()) return;
172
+
173
  document.location = 'admin.php?page=cp_calculated_fields_form&a=1&r='+Math.random()+'&name='+encodeURIComponent(calname)+'&category='+encodeURIComponent(category)+'&_cpcff_nonce=<?php echo wp_create_nonce( 'cff-add-form' ); ?>';
174
  }
175
 
329
  <h3 class='hndle' style="padding:5px;"><span><?php _e( 'New Form', 'calculated-fields-form' ); ?></span></h3>
330
  <div class="inside">
331
  <form name="additem">
332
+ <?php _e( 'Item Name', 'calculated-fields-form' ); ?>(*):<br />
333
  <div>
334
+ <input type="text" name="cp_itemname" id="cp_itemname" value="" onkeyup="cp_addItem_keyup( event );" style="margin-top:5px;" required />
335
  <input type="text" name="calculated-fields-form-category" id="calculated-fields-form-category" value="<?php print esc_attr($cff_current_form_category); ?>" style="margin-top:5px;" placeholder="<?php esc_attr_e('Category', 'calculated-fields-form'); ?>" list="calculated-fields-form-categories" />
336
  <datalist id="calculated-fields-form-categories">
337
  <?php
inc/cpcff_public_int.inc.php CHANGED
@@ -52,6 +52,7 @@ if( !empty( $form_data ) )
52
  print '<style>'.$form_data[ 1 ][ 0 ]->customstyles.'</style>';
53
  }
54
  }
 
55
  $form_data[ 1 ][ 'formid' ]="cp_calculatedfieldsf_pform_".CPCFF_MAIN::$form_counter;
56
  ?>
57
  <form name="<?php echo $form_data[ 1 ][ 'formid' ]; ?>" id="<?php echo $form_data[ 1 ][ 'formid' ]; ?>" action="?" method="post" enctype="multipart/form-data" class="cff-form <?php
52
  print '<style>'.$form_data[ 1 ][ 0 ]->customstyles.'</style>';
53
  }
54
  }
55
+ if(isset($form_data[ 1 ]) && is_object($form_data[ 1 ])) $form_data[ 1 ] = (array) $form_data[ 1 ];
56
  $form_data[ 1 ][ 'formid' ]="cp_calculatedfieldsf_pform_".CPCFF_MAIN::$form_counter;
57
  ?>
58
  <form name="<?php echo $form_data[ 1 ][ 'formid' ]; ?>" id="<?php echo $form_data[ 1 ][ 'formid' ]; ?>" action="?" method="post" enctype="multipart/form-data" class="cff-form <?php
js/fbuilder-pro-public.jquery.js CHANGED
@@ -1,4 +1,4 @@
1
- $.fbuilder['version'] = '1.1.108';
2
  $.fbuilder['controls'] = $.fbuilder['controls'] || {};
3
  $.fbuilder['forms'] = $.fbuilder['forms'] || {};
4
 
1
+ $.fbuilder['version'] = '1.1.109';
2
  $.fbuilder['controls'] = $.fbuilder['controls'] || {};
3
  $.fbuilder['forms'] = $.fbuilder['forms'] || {};
4
 
js/fields-public/16_fbuilder.fsummary.js CHANGED
@@ -1,147 +1,151 @@
1
- $.fbuilder.controls['fsummary'] = function(){};
2
- $.extend(
3
- $.fbuilder.controls['fsummary'].prototype,
4
- $.fbuilder.controls['ffields'].prototype,
5
- {
6
- title:"Summary",
7
- ftype:"fsummary",
8
- fields:"",
9
- exclude_empty: false,
10
- titleClassname:"summary-field-title",
11
- valueClassname:"summary-field-value",
12
- fieldsArray:[],
13
- show:function()
14
- {
15
- var me = this;
16
- if('string' != typeof me.fields) return;
17
- var p = $.trim(me.fields.replace(/\,+/g, ',')).split(','),
18
- l = p.length;
19
- if(l)
20
- {
21
- var str = '<div class="fields '+cff_esc_attr(me.csslayout)+' '+me.name+' cff-summary-field" id="field'+me.form_identifier+'-'+me.index+'">'+((!/^\s*$/.test(me.title)) ? '<h2>'+me.title+'</h2>': '')+'<div id="'+me.name+'">';
22
- for(var i = 0; i < l; i++)
23
- {
24
- if(!/^\s*$/.test(p[i]))
25
- {
26
- p[i] = $.trim(p[i]);
27
- str += '<div ref="'+p[i]+me.form_identifier+'" class="cff-summary-item"><span class="'+cff_esc_attr(me.titleClassname)+' cff-summary-title"></span><span class="'+cff_esc_attr(me.valueClassname)+' cff-summary-value"></span></div>';
28
- }
29
- }
30
- str += '</div></div>';
31
-
32
- return str;
33
- }
34
- },
35
- after_show: function(){
36
- var me = this;
37
- if('string' != typeof me.fields) return;
38
- var p = $.trim(me.fields.replace(/\,+/g, ',')).split(','),
39
- l = p.length;
40
-
41
- if(l)
42
- {
43
- for(var i = 0; i < l; i++)
44
- {
45
- if(!/^\s*$/.test(p[i]))
46
- {
47
- p[i] = $.trim(p[i]);
48
- me.fieldsArray.push(p[i]+me.form_identifier);
49
- $(document).on('change', '[id*="'+p[i]+me.form_identifier+'"]', function(){ me.update(); });
50
- }
51
- }
52
- $(document).on('showHideDepEvent', function(evt, form_identifier)
53
- {
54
- me.update();
55
- });
56
-
57
- $('#cp_calculatedfieldsf_pform'+me.form_identifier).bind('reset', function(){ setTimeout(function(){ me.update(); }, 10); });
58
- }
59
- },
60
- update:function()
61
- {
62
- for (var j = 0, k = this.fieldsArray.length; j < k; j++)
63
- {
64
- var i = this.fieldsArray[j],
65
- e = $('[id="'+i+'"],[id^="'+i+'_rb"],[id^="'+i+'_cb"]'),
66
- tt = $('[ref="'+i+'"]');
67
-
68
- if(e.length && tt.length)
69
- {
70
- var l = $('[id="'+i+'"],[id^="'+i+'_rb"],[id^="'+i+'_cb"]')
71
- .closest('.fields')
72
- .find('label:first')
73
- .clone()
74
- .find('.r,.dformat')
75
- .remove()
76
- .end(),
77
- t = $.trim(l.text())
78
- .replace(/\:$/,''),
79
- v = [];
80
-
81
- e.each(
82
- function(){
83
- var e = $(this);
84
- if(/(checkbox|radio)/i.test(e.attr('type')) && !e.is(':checked'))
85
- {
86
- return;
87
- }
88
- else if(e[0].tagName == 'SELECT')
89
- {
90
- var vt = [];
91
- e.find('option:selected').each(function(){vt.push($(this).attr('vt'));});
92
- v.push(vt.join(', '));
93
- }
94
- else
95
- {
96
- if(e.attr('vt'))
97
- {
98
- v.push(e.attr('vt'));
99
- }
100
- else
101
- {
102
- var d = $('[id="'+i+'_date"]');
103
- if(d.length)
104
- {
105
- if(d.is(':disabled'))
106
- {
107
- v.push(e.val().replace(d.val(),''));
108
- }
109
- else v.push(e.val());
110
- }
111
- else
112
- {
113
- if(e.attr('type') == 'file')
114
- {
115
- var f = [];
116
- $.each(e[0].files, function(i,o){f.push(o.name);});
117
- v.push(f.join(', '));
118
- }
119
- else
120
- {
121
- var c = $('[id="'+i+'_caption"]');
122
- v.push((c.length && !/^\s*$/.test(c.html())) ? c.html() : e.val());
123
- }
124
- }
125
- }
126
- }
127
- }
128
- );
129
- v = v.join(', ');
130
- tt.find('.cff-summary-title')[(/^\s*$/.test(t)) ? 'hide' : 'show']().html(t);
131
-
132
- var tmp = $('<div></div>').html(v);
133
- tmp.find('script').remove();
134
- tt.find('.cff-summary-value').html(tmp.html().replace(/\s(on[a-z]*\s*=)/gi, "_$1"));
135
-
136
- if(e.hasClass('ignore') || (this.exclude_empty && v == ''))
137
- {
138
- tt.hide();
139
- }
140
- else
141
- {
142
- tt.show();
143
- }
144
- }
145
- }
146
- }
147
- });
 
 
 
 
1
+ $.fbuilder.controls['fsummary'] = function(){};
2
+ $.extend(
3
+ $.fbuilder.controls['fsummary'].prototype,
4
+ $.fbuilder.controls['ffields'].prototype,
5
+ {
6
+ title:"Summary",
7
+ ftype:"fsummary",
8
+ fields:"",
9
+ exclude_empty: false,
10
+ titleClassname:"summary-field-title",
11
+ valueClassname:"summary-field-value",
12
+ fieldsArray:[],
13
+ show:function()
14
+ {
15
+ var me = this;
16
+ if('string' != typeof me.fields) return;
17
+ var p = $.trim(me.fields.replace(/\,+/g, ',')).split(','),
18
+ l = p.length;
19
+ if(l)
20
+ {
21
+ var str = '<div class="fields '+cff_esc_attr(me.csslayout)+' '+me.name+' cff-summary-field" id="field'+me.form_identifier+'-'+me.index+'">'+((!/^\s*$/.test(me.title)) ? '<h2>'+me.title+'</h2>': '')+'<div id="'+me.name+'">';
22
+ for(var i = 0; i < l; i++)
23
+ {
24
+ if(!/^\s*$/.test(p[i]))
25
+ {
26
+ p[i] = $.trim(p[i]);
27
+ str += '<div ref="'+p[i]+me.form_identifier+'" class="cff-summary-item"><span class="'+cff_esc_attr(me.titleClassname)+' cff-summary-title"></span><span class="'+cff_esc_attr(me.valueClassname)+' cff-summary-value"></span></div>';
28
+ }
29
+ }
30
+ str += '</div></div>';
31
+
32
+ return str;
33
+ }
34
+ },
35
+ after_show: function(){
36
+ var me = this;
37
+ if('string' != typeof me.fields) return;
38
+ var p = $.trim(me.fields.replace(/\,+/g, ',')).split(','),
39
+ l = p.length;
40
+
41
+ if(l)
42
+ {
43
+ for(var i = 0; i < l; i++)
44
+ {
45
+ if(!/^\s*$/.test(p[i]))
46
+ {
47
+ p[i] = $.trim(p[i]);
48
+ me.fieldsArray.push(p[i]+me.form_identifier);
49
+ $(document).on('change', '[id*="'+p[i]+me.form_identifier+'"]', function(){ me.update(); });
50
+ }
51
+ }
52
+ $(document).on('showHideDepEvent', function(evt, form_identifier)
53
+ {
54
+ me.update();
55
+ });
56
+
57
+ $('#cp_calculatedfieldsf_pform'+me.form_identifier).bind('reset', function(){ setTimeout(function(){ me.update(); }, 10); });
58
+ }
59
+ },
60
+ update:function()
61
+ {
62
+ for (var j = 0, k = this.fieldsArray.length; j < k; j++)
63
+ {
64
+ var i = this.fieldsArray[j],
65
+ e = $('[id="'+i+'"],[id^="'+i+'_rb"],[id^="'+i+'_cb"]'),
66
+ tt = $('[ref="'+i+'"]');
67
+
68
+ if(e.length && tt.length)
69
+ {
70
+ var l = $('[id="'+i+'"],[id^="'+i+'_rb"],[id^="'+i+'_cb"]')
71
+ .closest('.fields')
72
+ .find('label:first')
73
+ .clone()
74
+ .find('.r,.dformat')
75
+ .remove()
76
+ .end(),
77
+ t = $.trim(l.text())
78
+ .replace(/\:$/,''),
79
+ v = [];
80
+
81
+ e.each(
82
+ function(){
83
+ var e = $(this);
84
+ if(/(checkbox|radio)/i.test(e.attr('type')) && !e.is(':checked'))
85
+ {
86
+ return;
87
+ }
88
+ else if(e[0].tagName == 'SELECT')
89
+ {
90
+ var vt = [];
91
+ e.find('option:selected').each(function(){vt.push($(this).attr('vt'));});
92
+ v.push(vt.join(', '));
93
+ }
94
+ else
95
+ {
96
+ if(e.attr('vt'))
97
+ {
98
+ v.push(e.attr('vt'));
99
+ }
100
+ else if( e.attr( 'summary' ) )
101
+ {
102
+ v.push( $( '#' + i ).closest( '.fields' ).find( '.'+e.attr( 'summary' )+i ).html() );
103
+ }
104
+ else
105
+ {
106
+ var d = $('[id="'+i+'_date"]');
107
+ if(d.length)
108
+ {
109
+ if(d.is(':disabled'))
110
+ {
111
+ v.push(e.val().replace(d.val(),''));
112
+ }
113
+ else v.push(e.val());
114
+ }
115
+ else
116
+ {
117
+ if(e.attr('type') == 'file')
118
+ {
119
+ var f = [];
120
+ $.each(e[0].files, function(i,o){f.push(o.name);});
121
+ v.push(f.join(', '));
122
+ }
123
+ else
124
+ {
125
+ var c = $('[id="'+i+'_caption"]');
126
+ v.push((c.length && !/^\s*$/.test(c.html())) ? c.html() : e.val());
127
+ }
128
+ }
129
+ }
130
+ }
131
+ }
132
+ );
133
+ v = v.join(', ');
134
+ tt.find('.cff-summary-title')[(/^\s*$/.test(t)) ? 'hide' : 'show']().html(t);
135
+
136
+ var tmp = $('<div></div>').html(v);
137
+ tmp.find('script').remove();
138
+ tt.find('.cff-summary-value').html(tmp.html().replace(/\s(on[a-z]*\s*=)/gi, "_$1"));
139
+
140
+ if(e.hasClass('ignore') || (this.exclude_empty && v == ''))
141
+ {
142
+ tt.hide();
143
+ }
144
+ else
145
+ {
146
+ tt.show();
147
+ }
148
+ }
149
+ }
150
+ }
151
+ });
js/fields-public/32_fbuilder.fbutton.js CHANGED
@@ -47,12 +47,12 @@
47
  if(me.sLoading)
48
  {
49
  f.find('.cff-processing-form').remove();
50
- $('<div class="cff-processing-form"></div>').appendTo(f);
51
  }
52
  $(document).on('equationsQueueEmpty', function(evt, id){
53
  if(id == fid)
54
  {
55
- if(me.sLoading) e.closest('#fbuilder').find('.cff-processing-form').remove();
56
  $(document).off('equationsQueueEmpty');
57
  for(var i = 0, h = items.length; i < h; i++)
58
  {
47
  if(me.sLoading)
48
  {
49
  f.find('.cff-processing-form').remove();
50
+ $('<div class="cff-processing-form"></div>').appendTo(e.closest('#fbuilder'));
51
  }
52
  $(document).on('equationsQueueEmpty', function(evt, id){
53
  if(id == fid)
54
  {
55
+ if(me.sLoading) f.find('.cff-processing-form').remove();
56
  $(document).off('equationsQueueEmpty');
57
  for(var i = 0, h = items.length; i < h; i++)
58
  {
js/library.js CHANGED
@@ -36,7 +36,9 @@ jQuery(function () {
36
  <input type="button" class="button-secondary" value="Use It" />
37
  </div>
38
  </div>
39
- `;
 
 
40
 
41
  $.expr[":"].contains = $.expr.createPseudo(function (arg) {
42
  return function (elem) {
@@ -47,6 +49,13 @@ jQuery(function () {
47
  function openDialog() {
48
  var version = 'free',
49
  data = [];
 
 
 
 
 
 
 
50
  if (!$('.cff-form-library-container').length) {
51
  $('body').append(dialog_tpl);
52
 
@@ -150,7 +159,7 @@ jQuery(function () {
150
  };
151
 
152
  function getTemplate(id) {
153
- var form_name = encodeURIComponent($('[id="cp_itemname"]').val() || ''),
154
  category_name = encodeURIComponent($('[id="calculated-fields-form-category"]').val() || ''),
155
  url;
156
 
36
  <input type="button" class="button-secondary" value="Use It" />
37
  </div>
38
  </div>
39
+ `,
40
+
41
+ form_name_field;
42
 
43
  $.expr[":"].contains = $.expr.createPseudo(function (arg) {
44
  return function (elem) {
49
  function openDialog() {
50
  var version = 'free',
51
  data = [];
52
+ form_name_field = $('[id="cp_itemname"]'),
53
+ form_tag = $('[id="cp_itemname"]').closest('form')[0];
54
+
55
+ form_name_field.val(form_name_field.val().replace(/^\s*/, '').replace(/\s*$/, ''));
56
+
57
+ if('reportValidity' in form_tag && !form_tag.reportValidity()) return;
58
+
59
  if (!$('.cff-form-library-container').length) {
60
  $('body').append(dialog_tpl);
61
 
159
  };
160
 
161
  function getTemplate(id) {
162
+ var form_name = encodeURIComponent(form_name_field.val() || ''),
163
  category_name = encodeURIComponent($('[id="calculated-fields-form-category"]').val() || ''),
164
  url;
165
 
vendors/forms.js CHANGED
@@ -9,6 +9,31 @@ cff_forms_templates = {
9
  "category": "Basic Operations",
10
  "description": "Basic contact form.",
11
  "id": 19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  }, {
13
  "title": "Form With Optional Fields",
14
  "category": "Basic Operations",
9
  "category": "Basic Operations",
10
  "description": "Basic contact form.",
11
  "id": 19
12
+ }, {
13
+ "title": "Checkbox and Radio Buttons with Images",
14
+ "category": "Basic Operations",
15
+ "description": "Use img tags in the texts of checkboxes and radio buttons.",
16
+ "id": 21
17
+ }, {
18
+ "title": "DropDown fields with Images",
19
+ "category": "Basic Operations",
20
+ "description": "To display images in DropDown fields, you must enter img tags as their choices texts, and tick the Apply Select2 library attribute in its settings.",
21
+ "id": 22
22
+ }, {
23
+ "title": "Multi-Page Form",
24
+ "category": "Basic Operations",
25
+ "description": "Multipage contact form. Inserts page break controls between fields belonging to different pages.",
26
+ "id": 23
27
+ }, {
28
+ "title": "Dependencies",
29
+ "category": "Basic Operations",
30
+ "description": "Define dependencies between fields.",
31
+ "id": 24
32
+ }, {
33
+ "title": "Converting Values",
34
+ "category": "Basic Operations",
35
+ "description": "Convert a value from one unit of measurement to another.",
36
+ "id": 25
37
  }, {
38
  "title": "Form With Optional Fields",
39
  "category": "Basic Operations",