Version Description
- Use a different email regex to allow more characters, and longer TLDs
- Only load custom styles on the styler. Don't include it on the manage styles, or custom css tabs. Bad custom css can make the page uneditable.
- Fix issue preventing the option to Allow the multiple recaptchas to be turned off
- Fixed issue with white space allowed in field options when bulk editing
- Use javascript instead of jQuery to scroll after submit
- Add missing styling to make inline labels work with checkbox/radio fields
- Pro Features: *
- Add checkbox option to Lookup fields
- Hide empty radio/checkbox Lookup fields
- Allow autocomplete Lookup fields to populate text fields
- Add filter for setting field type used for logic 'frm_logic_FIELDTYPE_input_type'
- Prevent duplicate submissions during in-place-edit or ajax-loaded forms
- Make sure post fields show up correctly on edit
- Always show the number range options in a number field
- Fixed issue with dynamic list fields not saving a value when the visibility is set to administrator
- check for __frmDatepicker before using it. This resolves issues when using a date field with custom code.
- Strip slashes shown in an entry right after POSTing
- If a field in calculation is missing, don't break the js
- Prevent conditional loops with dropdown fields
- Fixed issue with Dynamic fields not showing up when expected, and when editing 3+ level Dynamic fields
- Remove the country field when the "other" address option is selected
- Fixed issue with required Address field on conditionally hidden page. They were still required, even when skipped.
- Fixed star fields on multi-paged ajax forms. Going back a page was showing radio buttons.
- Fixed issue with small autocomplete field, when it is hidden on page load.
- Fixed issue that allowed conditional fields to show right after hitting "save draft"
- Fixed default values inside of conditional logic
- Fixed issue preventing "none" from being selected for the date styling in the styles
Download this release
Release Info
Developer | sswells |
Plugin | Formidable Forms – Form Builder for WordPress |
Version | 2.01.01 |
Comparing to | |
See all releases |
Code changes from version 2.01.0 to 2.01.01
- classes/controllers/FrmFieldsController.php +4 -2
- classes/controllers/FrmStylesController.php +7 -0
- classes/helpers/FrmAppHelper.php +2 -2
- classes/helpers/FrmEntriesHelper.php +2 -0
- classes/helpers/FrmFormsHelper.php +1 -1
- classes/models/FrmEntry.php +10 -5
- classes/models/FrmSettings.php +1 -0
- classes/views/styles/_date-fields.php +7 -2
- css/custom_theme.css.php +6 -2
- css/frm_admin.css +5 -0
- formidable.php +1 -1
- js/formidable.js +251 -58
- js/formidable.min.js +89 -86
- readme.txt +30 -1
classes/controllers/FrmFieldsController.php
CHANGED
@@ -421,8 +421,10 @@ class FrmFieldsController {
|
|
421 |
}
|
422 |
|
423 |
$field = FrmFieldsHelper::setup_edit_vars($field);
|
424 |
-
|
425 |
-
|
|
|
|
|
426 |
if ( $field['separate_value'] ) {
|
427 |
foreach ( $opts as $opt_key => $opt ) {
|
428 |
if ( strpos($opt, '|') !== false ) {
|
421 |
}
|
422 |
|
423 |
$field = FrmFieldsHelper::setup_edit_vars($field);
|
424 |
+
$opts = FrmAppHelper::get_param( 'opts', '', 'post', 'wp_kses_post' );
|
425 |
+
$opts = explode( "\n", rtrim( $opts, "\n" ) );
|
426 |
+
$opts = array_map( 'trim', $opts );
|
427 |
+
|
428 |
if ( $field['separate_value'] ) {
|
429 |
foreach ( $opts as $opt_key => $opt ) {
|
430 |
if ( strpos($opt, '|') !== false ) {
|
classes/controllers/FrmStylesController.php
CHANGED
@@ -50,6 +50,13 @@ class FrmStylesController {
|
|
50 |
}
|
51 |
|
52 |
self::load_pro_hooks();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
wp_enqueue_script('jquery-ui-datepicker');
|
54 |
|
55 |
$version = FrmAppHelper::plugin_version();
|
50 |
}
|
51 |
|
52 |
self::load_pro_hooks();
|
53 |
+
|
54 |
+
$style_tab = FrmAppHelper::get_param( 'frm_action', '', 'get', 'sanitize_title' );
|
55 |
+
if ( $style_tab == 'manage' || $style_tab == 'custom_css' ) {
|
56 |
+
// we only need to load these styles/scripts on the styler page
|
57 |
+
return;
|
58 |
+
}
|
59 |
+
|
60 |
wp_enqueue_script('jquery-ui-datepicker');
|
61 |
|
62 |
$version = FrmAppHelper::plugin_version();
|
classes/helpers/FrmAppHelper.php
CHANGED
@@ -4,13 +4,13 @@ if ( ! defined('ABSPATH') ) {
|
|
4 |
}
|
5 |
|
6 |
class FrmAppHelper {
|
7 |
-
public static $db_version =
|
8 |
public static $pro_db_version = 34;
|
9 |
|
10 |
/**
|
11 |
* @since 2.0
|
12 |
*/
|
13 |
-
public static $plug_version = '2.01.
|
14 |
|
15 |
/**
|
16 |
* @since 1.07.02
|
4 |
}
|
5 |
|
6 |
class FrmAppHelper {
|
7 |
+
public static $db_version = 30; //version of the database we are moving to
|
8 |
public static $pro_db_version = 34;
|
9 |
|
10 |
/**
|
11 |
* @since 2.0
|
12 |
*/
|
13 |
+
public static $plug_version = '2.01.01';
|
14 |
|
15 |
/**
|
16 |
* @since 1.07.02
|
classes/helpers/FrmEntriesHelper.php
CHANGED
@@ -344,6 +344,8 @@ class FrmEntriesHelper {
|
|
344 |
} else {
|
345 |
$value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : '';
|
346 |
}
|
|
|
|
|
347 |
}
|
348 |
|
349 |
/**
|
344 |
} else {
|
345 |
$value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : '';
|
346 |
}
|
347 |
+
FrmAppHelper::sanitize_value( 'wp_kses_post', $value );
|
348 |
+
$value = stripslashes_deep( $value );
|
349 |
}
|
350 |
|
351 |
/**
|
classes/helpers/FrmFormsHelper.php
CHANGED
@@ -539,7 +539,7 @@ BEFORE_HTML;
|
|
539 |
}
|
540 |
|
541 |
public static function get_scroll_js( $form_id ) {
|
542 |
-
?><script type="text/javascript">
|
543 |
}
|
544 |
|
545 |
public static function edit_form_link( $form_id ) {
|
539 |
}
|
540 |
|
541 |
public static function get_scroll_js( $form_id ) {
|
542 |
+
?><script type="text/javascript">document.addEventListener('DOMContentLoaded',function(){frmFrontForm.scrollMsg(<?php echo (int) $form_id ?>);})</script><?php
|
543 |
}
|
544 |
|
545 |
public static function edit_form_link( $form_id ) {
|
classes/models/FrmEntry.php
CHANGED
@@ -449,11 +449,16 @@ class FrmEntry {
|
|
449 |
}
|
450 |
|
451 |
public static function getPageCount( $p_size, $where = '' ) {
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
|
|
|
|
|
|
|
|
|
|
457 |
}
|
458 |
|
459 |
/**
|
449 |
}
|
450 |
|
451 |
public static function getPageCount( $p_size, $where = '' ) {
|
452 |
+
$p_size = (int) $p_size;
|
453 |
+
$count = 1;
|
454 |
+
if ( $p_size ) {
|
455 |
+
if ( ! is_numeric( $where ) ) {
|
456 |
+
$where = self::getRecordCount( $where );
|
457 |
+
}
|
458 |
+
$count = ceil( (int) $where / $p_size );
|
459 |
+
}
|
460 |
+
|
461 |
+
return $count;
|
462 |
}
|
463 |
|
464 |
/**
|
classes/models/FrmSettings.php
CHANGED
@@ -196,6 +196,7 @@ class FrmSettings{
|
|
196 |
$this->pubkey = trim($params['frm_pubkey']);
|
197 |
$this->privkey = $params['frm_privkey'];
|
198 |
$this->re_lang = $params['frm_re_lang'];
|
|
|
199 |
|
200 |
$this->load_style = $params['frm_load_style'];
|
201 |
$this->preview_page_id = (int) $params['frm-preview-page-id'];
|
196 |
$this->pubkey = trim($params['frm_pubkey']);
|
197 |
$this->privkey = $params['frm_privkey'];
|
198 |
$this->re_lang = $params['frm_re_lang'];
|
199 |
+
$this->re_multi = isset( $params['frm_re_multi'] ) ? $params['frm_re_multi'] : 0;
|
200 |
|
201 |
$this->load_style = $params['frm_load_style'];
|
202 |
$this->preview_page_id = (int) $params['frm-preview-page-id'];
|
classes/views/styles/_date-fields.php
CHANGED
@@ -18,6 +18,7 @@ foreach ( $theme_names as $k => $v ) {
|
|
18 |
}
|
19 |
|
20 |
$alt_img_name = array_merge($theme_names, $alt_img_name);
|
|
|
21 |
unset($theme_names);
|
22 |
|
23 |
?>
|
@@ -26,9 +27,13 @@ unset($theme_names);
|
|
26 |
<label><?php _e( 'Theme', 'formidable' ) ?></label>
|
27 |
<select name="<?php echo esc_attr( $frm_style->get_field_name('theme_selector') ) ?>">
|
28 |
<?php foreach ( $jquery_themes as $theme_name => $theme_title ) { ?>
|
29 |
-
|
|
|
|
|
30 |
<?php } ?>
|
31 |
-
|
|
|
|
|
32 |
</select>
|
33 |
</div>
|
34 |
|
18 |
}
|
19 |
|
20 |
$alt_img_name = array_merge($theme_names, $alt_img_name);
|
21 |
+
$alt_img_name['-1'] = '';
|
22 |
unset($theme_names);
|
23 |
|
24 |
?>
|
27 |
<label><?php _e( 'Theme', 'formidable' ) ?></label>
|
28 |
<select name="<?php echo esc_attr( $frm_style->get_field_name('theme_selector') ) ?>">
|
29 |
<?php foreach ( $jquery_themes as $theme_name => $theme_title ) { ?>
|
30 |
+
<option value="<?php echo esc_attr( $theme_name ) ?>" id="90_<?php echo esc_attr( $alt_img_name[ $theme_name ] ); ?>" <?php selected( $theme_title, $style->post_content['theme_name'] ) ?>>
|
31 |
+
<?php echo esc_html( $theme_title ) ?>
|
32 |
+
</option>
|
33 |
<?php } ?>
|
34 |
+
<option value="-1" <?php selected( '-1', $style->post_content['theme_css'] ) ?>>
|
35 |
+
— <?php _e( 'None', 'formidable' ) ?> —
|
36 |
+
</option>
|
37 |
</select>
|
38 |
</div>
|
39 |
|
css/custom_theme.css.php
CHANGED
@@ -646,10 +646,13 @@ table.frmcal-calendar .frmcal-today .frmcal_date{
|
|
646 |
|
647 |
.frm_form_field.frm_left_container .frm_opt_container,
|
648 |
.frm_form_field.frm_right_container .frm_opt_container,
|
|
|
649 |
.frm_form_field.frm_left_container .frm-g-recaptcha,
|
650 |
.frm_form_field.frm_right_container .frm-g-recaptcha,
|
|
|
651 |
.frm_form_field.frm_left_container .g-recaptcha,
|
652 |
-
.frm_form_field.frm_right_container .g-recaptcha
|
|
|
653 |
display:inline-block;
|
654 |
}
|
655 |
|
@@ -1133,11 +1136,12 @@ html[xmlns] .frm_clearfix{
|
|
1133 |
|
1134 |
/* Start Chosen */
|
1135 |
.with_frm_style .chosen-container{
|
1136 |
-
font-size:<?php echo $defaults['field_font_size'] ?>;
|
1137 |
position:relative;
|
1138 |
display:inline-block;
|
1139 |
zoom:1;
|
1140 |
vertical-align:middle;
|
|
|
1141 |
-webkit-user-select:none;
|
1142 |
-moz-user-select:none;
|
1143 |
user-select:none;
|
646 |
|
647 |
.frm_form_field.frm_left_container .frm_opt_container,
|
648 |
.frm_form_field.frm_right_container .frm_opt_container,
|
649 |
+
.frm_form_field.frm_inline_container .frm_opt_container,
|
650 |
.frm_form_field.frm_left_container .frm-g-recaptcha,
|
651 |
.frm_form_field.frm_right_container .frm-g-recaptcha,
|
652 |
+
.frm_form_field.frm_inline_container .frm-g-recaptcha,
|
653 |
.frm_form_field.frm_left_container .g-recaptcha,
|
654 |
+
.frm_form_field.frm_right_container .g-recaptcha,
|
655 |
+
.frm_form_field.frm_inline_container .g-recaptcha{
|
656 |
display:inline-block;
|
657 |
}
|
658 |
|
1136 |
|
1137 |
/* Start Chosen */
|
1138 |
.with_frm_style .chosen-container{
|
1139 |
+
font-size:<?php echo esc_html( $defaults['field_font_size'] ) ?>;
|
1140 |
position:relative;
|
1141 |
display:inline-block;
|
1142 |
zoom:1;
|
1143 |
vertical-align:middle;
|
1144 |
+
width:100% !important;
|
1145 |
-webkit-user-select:none;
|
1146 |
-moz-user-select:none;
|
1147 |
user-select:none;
|
css/frm_admin.css
CHANGED
@@ -698,6 +698,11 @@ label input[type="checkbox"], label input[type="radio"]{vertical-align:baseline;
|
|
698 |
.frmbutton.ui-sortable-helper .frm-dropdown-menu{
|
699 |
display:none;
|
700 |
}
|
|
|
|
|
|
|
|
|
|
|
701 |
.frm_col_one, #postbox-container-1 .frm_field_list .button.frm_col_one{margin-right:10px;clear:both;}
|
702 |
.frm_html_legend pre{display:inline;}
|
703 |
.frm_code_list .frmkeys{display:none;}
|
698 |
.frmbutton.ui-sortable-helper .frm-dropdown-menu{
|
699 |
display:none;
|
700 |
}
|
701 |
+
|
702 |
+
.frmbutton.frm_tgateway{
|
703 |
+
display:none !important;
|
704 |
+
}
|
705 |
+
|
706 |
.frm_col_one, #postbox-container-1 .frm_field_list .button.frm_col_one{margin-right:10px;clear:both;}
|
707 |
.frm_html_legend pre{display:inline;}
|
708 |
.frm_code_list .frmkeys{display:none;}
|
formidable.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Formidable
|
4 |
Description: Quickly and easily create drag-and-drop forms
|
5 |
-
Version: 2.01.
|
6 |
Plugin URI: http://formidablepro.com/
|
7 |
Author URI: http://strategy11.com
|
8 |
Author: Strategy11
|
2 |
/*
|
3 |
Plugin Name: Formidable
|
4 |
Description: Quickly and easily create drag-and-drop forms
|
5 |
+
Version: 2.01.01
|
6 |
Plugin URI: http://formidablepro.com/
|
7 |
Author URI: http://strategy11.com
|
8 |
Author: Strategy11
|
js/formidable.js
CHANGED
@@ -65,7 +65,7 @@ function frmFrontFormJS(){
|
|
65 |
|
66 |
function triggerDateField() {
|
67 |
/*jshint validthis:true */
|
68 |
-
if ( this.className.indexOf('frm_custom_date') !== -1 ) {
|
69 |
return;
|
70 |
}
|
71 |
|
@@ -188,7 +188,7 @@ function frmFrontFormJS(){
|
|
188 |
|
189 |
function getOriginalEvent( e ) {
|
190 |
var originalEvent;
|
191 |
-
if ( typeof e.originalEvent !== 'undefined' ) {
|
192 |
originalEvent = 'value changed';
|
193 |
} else {
|
194 |
originalEvent = 'other';
|
@@ -930,7 +930,7 @@ function frmFrontFormJS(){
|
|
930 |
for ( var i = 0; i < inputs.length; i++ ) {
|
931 |
// Don't loop through every input in a radio/checkbox field
|
932 |
// TODO: Improve this for checkboxes and address fields
|
933 |
-
if ( i > 0 && prevInput.name == inputs[i].name && typeArray.indexOf( prevInput.type ) > -1 ) {
|
934 |
continue;
|
935 |
}
|
936 |
|
@@ -1025,16 +1025,23 @@ function frmFrontFormJS(){
|
|
1025 |
}
|
1026 |
|
1027 |
var prevInput;
|
|
|
1028 |
for ( var i= 0, l=inputs.length; i<l; i++ ){
|
1029 |
-
if ( i>0 && prevInput.name != inputs[i].name ) {
|
1030 |
// Only trigger a change after all inputs in a field are cleared
|
1031 |
triggerChange( jQuery(prevInput) );
|
1032 |
}
|
1033 |
|
|
|
|
|
1034 |
if ( inputs[i].type == 'radio' || inputs[i].type == 'checkbox' ) {
|
1035 |
inputs[i].checked = false;
|
1036 |
} else if ( inputs[i].tagName == 'SELECT' ) {
|
1037 |
-
inputs[i].selectedIndex
|
|
|
|
|
|
|
|
|
1038 |
|
1039 |
var autocomplete = document.getElementById( inputs[i].id + '_chosen' );
|
1040 |
if ( autocomplete !== null ) {
|
@@ -1048,7 +1055,9 @@ function frmFrontFormJS(){
|
|
1048 |
}
|
1049 |
|
1050 |
// trigger a change for the final input in the loop
|
1051 |
-
|
|
|
|
|
1052 |
}
|
1053 |
|
1054 |
function isFieldCurrentlyShown( containerId, formId ){
|
@@ -1306,8 +1315,8 @@ function frmFrontFormJS(){
|
|
1306 |
|
1307 |
if ( childFieldArgs.inputType == 'select' ) {
|
1308 |
maybeReplaceSelectLookupFieldOptions( childFieldArgs, childElement );
|
1309 |
-
} else if ( childFieldArgs.inputType == 'radio' ) {
|
1310 |
-
|
1311 |
}
|
1312 |
}
|
1313 |
|
@@ -1532,35 +1541,56 @@ function frmFrontFormJS(){
|
|
1532 |
}
|
1533 |
|
1534 |
/**
|
1535 |
-
*
|
1536 |
*
|
1537 |
-
* @since 2.01.
|
1538 |
* @param {Object} childFieldArgs
|
1539 |
-
* @param {
|
1540 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1541 |
* @param {Array} childFieldArgs.parents
|
1542 |
* @param {Array} childFieldArgs.parentVals
|
1543 |
* @param {string} childFieldArgs.fieldId
|
1544 |
* @param {string} childFieldArgs.repeatRow
|
1545 |
* @param {string} childFieldArgs.fieldKey
|
1546 |
-
* @param
|
1547 |
-
|
1548 |
-
function
|
1549 |
var optContainer = childDiv.getElementsByClassName( 'frm_opt_container' )[0];
|
1550 |
-
|
1551 |
|
1552 |
-
var
|
1553 |
-
if ( childFieldArgs.
|
1554 |
-
|
|
|
|
|
1555 |
}
|
1556 |
-
|
1557 |
-
|
1558 |
|
1559 |
jQuery.ajax({
|
1560 |
type:'POST',
|
1561 |
url:frm_js.ajax_url,
|
1562 |
data:{
|
1563 |
-
action:'
|
1564 |
parent_fields:childFieldArgs.parents,
|
1565 |
parent_vals:childFieldArgs.parentVals,
|
1566 |
field_id:childFieldArgs.fieldId,
|
@@ -1570,11 +1600,61 @@ function frmFrontFormJS(){
|
|
1570 |
},
|
1571 |
success:function(newHtml){
|
1572 |
optContainer.innerHTML = newHtml;
|
1573 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1574 |
}
|
1575 |
});
|
1576 |
}
|
1577 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1578 |
// Insert the loading icon
|
1579 |
function addLoadingIconJS( optContainer ) {
|
1580 |
optContainer.innerHTML = '<span class="frm-loading-img"></span>';
|
@@ -1662,21 +1742,32 @@ function frmFrontFormJS(){
|
|
1662 |
|
1663 |
// Update a Dynamic field's data or options
|
1664 |
function updateDynamicField( depFieldArgs, onCurrentPage ) {
|
1665 |
-
// If field is not on current page, return
|
1666 |
-
if ( ! onCurrentPage ) {
|
1667 |
-
return;
|
1668 |
-
}
|
1669 |
-
|
1670 |
var depFieldArgsCopy = cloneObjectForDynamicFields( depFieldArgs );
|
1671 |
|
1672 |
if ( depFieldArgsCopy.inputType == 'data' ) {
|
1673 |
-
updateDynamicListData( depFieldArgsCopy );
|
1674 |
} else {
|
1675 |
-
|
|
|
|
|
|
|
1676 |
}
|
1677 |
}
|
1678 |
|
1679 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1680 |
function cloneObjectForDynamicFields( depFieldArgs ){
|
1681 |
var dataLogic = {
|
1682 |
actualValue:depFieldArgs.dataLogic.actualValue,
|
@@ -1685,8 +1776,10 @@ function frmFrontFormJS(){
|
|
1685 |
|
1686 |
var dynamicFieldArgs = {
|
1687 |
fieldId:depFieldArgs.fieldId,
|
|
|
1688 |
formId:depFieldArgs.formId,
|
1689 |
containerId:depFieldArgs.containerId,
|
|
|
1690 |
dataLogic:dataLogic,
|
1691 |
children:'',
|
1692 |
inputType:depFieldArgs.inputType
|
@@ -1695,12 +1788,21 @@ function frmFrontFormJS(){
|
|
1695 |
return dynamicFieldArgs;
|
1696 |
}
|
1697 |
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1704 |
|
1705 |
jQuery.ajax({
|
1706 |
type:'POST',url:frm_js.ajax_url,
|
@@ -1712,29 +1814,41 @@ function frmFrontFormJS(){
|
|
1712 |
nonce:frm_js.nonce
|
1713 |
},
|
1714 |
success:function(html){
|
1715 |
-
|
1716 |
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
|
|
|
|
|
|
|
|
1721 |
} else {
|
1722 |
-
|
1723 |
}
|
1724 |
}
|
1725 |
});
|
1726 |
}
|
1727 |
|
1728 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1729 |
function updateDynamicFieldOptions( depFieldArgs, fieldElement ){
|
1730 |
var $fieldDiv = jQuery( '#' + depFieldArgs.containerId );
|
1731 |
-
var $optContainer = $fieldDiv.find('.frm_opt_container');
|
1732 |
|
1733 |
var hiddenInput = $fieldDiv.find('select[name^="item_meta"], textarea[name^="item_meta"], input[name^="item_meta"]');
|
1734 |
var prevVal = getPrevFieldValue( hiddenInput );
|
1735 |
var defaultVal = hiddenInput.data('frmval');
|
1736 |
|
1737 |
-
|
1738 |
|
1739 |
jQuery.ajax({
|
1740 |
type:'POST',
|
@@ -1750,9 +1864,12 @@ function frmFrontFormJS(){
|
|
1750 |
nonce:frm_js.nonce
|
1751 |
},
|
1752 |
success:function(html){
|
|
|
1753 |
$optContainer.html(html);
|
1754 |
var $dynamicFieldInputs = $optContainer.find('select, input, textarea');
|
1755 |
|
|
|
|
|
1756 |
if ( html === '' || ( $dynamicFieldInputs.length == 1 && $dynamicFieldInputs.attr('type') == 'hidden' ) ) {
|
1757 |
hideDynamicField( depFieldArgs );
|
1758 |
} else {
|
@@ -1763,11 +1880,66 @@ function frmFrontFormJS(){
|
|
1763 |
|
1764 |
}
|
1765 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1766 |
// Insert the loading icon
|
1767 |
function addLoadingIcon( $optContainer ) {
|
1768 |
$optContainer.html( '<span class="frm-loading-img"></span>' );
|
1769 |
}
|
1770 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1771 |
// Get the previous field value in a Dynamic field
|
1772 |
function getPrevFieldValue( inputs ) {
|
1773 |
var prev = [];
|
@@ -1937,6 +2109,10 @@ function frmFrontFormJS(){
|
|
1937 |
totalField = getSiblingField( fieldInfo );
|
1938 |
}
|
1939 |
|
|
|
|
|
|
|
|
|
1940 |
// loop through the fields in this calculation
|
1941 |
thisFullCalc = getValsForSingleCalc( thisCalc, thisFullCalc, all_calcs, vals, fieldInfo );
|
1942 |
|
@@ -1954,7 +2130,7 @@ function frmFrontFormJS(){
|
|
1954 |
|
1955 |
var total = parseFloat(eval(thisFullCalc));
|
1956 |
|
1957 |
-
if ( typeof total === 'undefined' ) {
|
1958 |
total = 0;
|
1959 |
}
|
1960 |
|
@@ -2473,7 +2649,7 @@ function frmFrontFormJS(){
|
|
2473 |
|
2474 |
var isConf = (fieldID.indexOf('conf_') === 0);
|
2475 |
if ( emailAddress !== '' || isConf ) {
|
2476 |
-
var re = /^([\
|
2477 |
var invalidMsg = getFieldValidationMessage( field, 'data-invmsg' );
|
2478 |
if ( emailAddress !== '' && re.test( emailAddress ) === false ) {
|
2479 |
errors[ fieldID ] = invalidMsg;
|
@@ -2592,6 +2768,11 @@ function frmFrontFormJS(){
|
|
2592 |
jQuery(document.getElementById('frm_edit_'+ entryIdField.val())).find('a').addClass('frm_ajax_edited').click();
|
2593 |
}
|
2594 |
|
|
|
|
|
|
|
|
|
|
|
2595 |
checkFieldsOnPage();
|
2596 |
}else{
|
2597 |
jQuery(object).find('input[type="submit"], input[type="button"]').removeAttr('disabled');
|
@@ -2630,10 +2811,12 @@ function frmFrontFormJS(){
|
|
2630 |
if ( $recaptcha.length ) {
|
2631 |
show_captcha = true;
|
2632 |
var recaptchaID = $recaptcha.data('rid');
|
2633 |
-
if (
|
2634 |
-
|
2635 |
-
|
2636 |
-
|
|
|
|
|
2637 |
}
|
2638 |
}
|
2639 |
}
|
@@ -3068,11 +3251,7 @@ function frmFrontFormJS(){
|
|
3068 |
}
|
3069 |
});
|
3070 |
|
3071 |
-
|
3072 |
-
if ( star.length > 0 ) {
|
3073 |
-
// trigger star fields
|
3074 |
-
jQuery('.star').rating();
|
3075 |
-
}
|
3076 |
|
3077 |
// trigger autocomplete
|
3078 |
loadChosen();
|
@@ -3121,6 +3300,9 @@ function frmFrontFormJS(){
|
|
3121 |
$edit.html(cancel);
|
3122 |
checkConditionalLogic( 'editInPlace' );
|
3123 |
checkFieldsOnPage();
|
|
|
|
|
|
|
3124 |
}
|
3125 |
});
|
3126 |
return false;
|
@@ -3176,6 +3358,7 @@ function frmFrontFormJS(){
|
|
3176 |
checkPreviouslyHiddenFields();
|
3177 |
loadDateFields();
|
3178 |
loadCustomInputMasks();
|
|
|
3179 |
loadChosen();
|
3180 |
checkDynamicFields();
|
3181 |
checkLookupFields();
|
@@ -3198,6 +3381,16 @@ function frmFrontFormJS(){
|
|
3198 |
}
|
3199 |
}
|
3200 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3201 |
function checkConditionalLogic( event ) {
|
3202 |
if (typeof __frmHideOrShowFields !== 'undefined') {
|
3203 |
frmFrontForm.hideOrShowFields( __frmHideOrShowFields, event );
|
@@ -3435,8 +3628,8 @@ function frmFrontFormJS(){
|
|
3435 |
}
|
3436 |
});
|
3437 |
|
3438 |
-
checkFieldsOnPage();
|
3439 |
checkConditionalLogic( 'pageLoad' );
|
|
|
3440 |
|
3441 |
// Add fallbacks for the beloved IE8
|
3442 |
addIndexOfFallbackForIE8();
|
65 |
|
66 |
function triggerDateField() {
|
67 |
/*jshint validthis:true */
|
68 |
+
if ( this.className.indexOf('frm_custom_date') !== -1 || typeof __frmDatepicker === 'undefined' ) {
|
69 |
return;
|
70 |
}
|
71 |
|
188 |
|
189 |
function getOriginalEvent( e ) {
|
190 |
var originalEvent;
|
191 |
+
if ( typeof e.originalEvent !== 'undefined' || e.currentTarget.className.indexOf( 'frm_chzn') > -1 ) {
|
192 |
originalEvent = 'value changed';
|
193 |
} else {
|
194 |
originalEvent = 'other';
|
930 |
for ( var i = 0; i < inputs.length; i++ ) {
|
931 |
// Don't loop through every input in a radio/checkbox field
|
932 |
// TODO: Improve this for checkboxes and address fields
|
933 |
+
if ( i > 0 && typeof prevInput !== 'undefined' && prevInput.name == inputs[i].name && typeArray.indexOf( prevInput.type ) > -1 ) {
|
934 |
continue;
|
935 |
}
|
936 |
|
1025 |
}
|
1026 |
|
1027 |
var prevInput;
|
1028 |
+
var valueChanged = true;
|
1029 |
for ( var i= 0, l=inputs.length; i<l; i++ ){
|
1030 |
+
if ( i>0 && prevInput.name != inputs[i].name && valueChanged === true ) {
|
1031 |
// Only trigger a change after all inputs in a field are cleared
|
1032 |
triggerChange( jQuery(prevInput) );
|
1033 |
}
|
1034 |
|
1035 |
+
valueChanged = true;
|
1036 |
+
|
1037 |
if ( inputs[i].type == 'radio' || inputs[i].type == 'checkbox' ) {
|
1038 |
inputs[i].checked = false;
|
1039 |
} else if ( inputs[i].tagName == 'SELECT' ) {
|
1040 |
+
if ( inputs[i].selectedIndex === 0 ) {
|
1041 |
+
valueChanged = false;
|
1042 |
+
} else {
|
1043 |
+
inputs[i].selectedIndex = 0;
|
1044 |
+
}
|
1045 |
|
1046 |
var autocomplete = document.getElementById( inputs[i].id + '_chosen' );
|
1047 |
if ( autocomplete !== null ) {
|
1055 |
}
|
1056 |
|
1057 |
// trigger a change for the final input in the loop
|
1058 |
+
if ( valueChanged === true ) {
|
1059 |
+
triggerChange(jQuery(prevInput));
|
1060 |
+
}
|
1061 |
}
|
1062 |
|
1063 |
function isFieldCurrentlyShown( containerId, formId ){
|
1315 |
|
1316 |
if ( childFieldArgs.inputType == 'select' ) {
|
1317 |
maybeReplaceSelectLookupFieldOptions( childFieldArgs, childElement );
|
1318 |
+
} else if ( childFieldArgs.inputType == 'radio' || childFieldArgs.inputType == 'checkbox' ) {
|
1319 |
+
maybeReplaceCbRadioLookupOptions( childFieldArgs, childElement );
|
1320 |
}
|
1321 |
}
|
1322 |
|
1541 |
}
|
1542 |
|
1543 |
/**
|
1544 |
+
* Either hide checkbox/radio Lookup field or update its options
|
1545 |
*
|
1546 |
+
* @since 2.01.01
|
1547 |
* @param {Object} childFieldArgs
|
1548 |
+
* @param {object} childDiv
|
1549 |
+
*/
|
1550 |
+
function maybeReplaceCbRadioLookupOptions( childFieldArgs, childDiv ) {
|
1551 |
+
if ( childFieldArgs.parentVals === false ) {
|
1552 |
+
// If any parents have blank values, don't waste time looking for values
|
1553 |
+
|
1554 |
+
var inputs = childDiv.getElementsByTagName( 'input' );
|
1555 |
+
maybeHideRadioLookup( childFieldArgs, childDiv );
|
1556 |
+
clearValueForInputs( inputs);
|
1557 |
+
|
1558 |
+
} else {
|
1559 |
+
replaceCbRadioLookupOptions( childFieldArgs, childDiv );
|
1560 |
+
}
|
1561 |
+
}
|
1562 |
+
|
1563 |
+
/**
|
1564 |
+
* Update the options in a checkbox/radio lookup field
|
1565 |
+
*
|
1566 |
+
* @since 2.01.01
|
1567 |
+
* @param {Object} childFieldArgs
|
1568 |
+
* @param {string} childFieldArgs.inputType
|
1569 |
* @param {Array} childFieldArgs.parents
|
1570 |
* @param {Array} childFieldArgs.parentVals
|
1571 |
* @param {string} childFieldArgs.fieldId
|
1572 |
* @param {string} childFieldArgs.repeatRow
|
1573 |
* @param {string} childFieldArgs.fieldKey
|
1574 |
+
* @param {object} childDiv
|
1575 |
+
*/
|
1576 |
+
function replaceCbRadioLookupOptions( childFieldArgs, childDiv ) {
|
1577 |
var optContainer = childDiv.getElementsByClassName( 'frm_opt_container' )[0];
|
1578 |
+
var inputs = optContainer.getElementsByTagName( 'input' );
|
1579 |
|
1580 |
+
var currentValue = '';
|
1581 |
+
if ( childFieldArgs.inputType == 'radio' ) {
|
1582 |
+
currentValue = getValueFromRadioInputs( inputs );
|
1583 |
+
} else {
|
1584 |
+
currentValue = getValuesFromCheckboxInputs(inputs);
|
1585 |
}
|
1586 |
+
|
1587 |
+
addLoadingIconJS( optContainer );
|
1588 |
|
1589 |
jQuery.ajax({
|
1590 |
type:'POST',
|
1591 |
url:frm_js.ajax_url,
|
1592 |
data:{
|
1593 |
+
action:'frm_replace_cb_radio_lookup_options',
|
1594 |
parent_fields:childFieldArgs.parents,
|
1595 |
parent_vals:childFieldArgs.parentVals,
|
1596 |
field_id:childFieldArgs.fieldId,
|
1600 |
},
|
1601 |
success:function(newHtml){
|
1602 |
optContainer.innerHTML = newHtml;
|
1603 |
+
|
1604 |
+
if ( inputs.length == 1 && inputs[0].value === '' ) {
|
1605 |
+
maybeHideRadioLookup( childFieldArgs, childDiv );
|
1606 |
+
} else {
|
1607 |
+
maybeShowRadioLookup( childFieldArgs, childDiv );
|
1608 |
+
}
|
1609 |
+
|
1610 |
+
triggerChange( jQuery( inputs[0] ), childFieldArgs.fieldKey );
|
1611 |
}
|
1612 |
});
|
1613 |
}
|
1614 |
|
1615 |
+
/**
|
1616 |
+
* Hide a Radio Lookup field if it doesn't have any options
|
1617 |
+
*
|
1618 |
+
* @since 2.01.01
|
1619 |
+
* @param {Object} childFieldArgs
|
1620 |
+
* @param {string} childFieldArgs.formId
|
1621 |
+
* @param {object} childDiv
|
1622 |
+
*/
|
1623 |
+
function maybeHideRadioLookup( childFieldArgs, childDiv ) {
|
1624 |
+
if ( isFieldConditionallyHidden( childDiv.id, childFieldArgs.formId ) ) {
|
1625 |
+
return;
|
1626 |
+
}
|
1627 |
+
|
1628 |
+
hideFieldContainer( childDiv.id );
|
1629 |
+
addToHideFields( childDiv.id, childFieldArgs.formId );
|
1630 |
+
}
|
1631 |
+
|
1632 |
+
/**
|
1633 |
+
* Show a radio Lookup field if it has options and conditional logic says it should be shown
|
1634 |
+
*
|
1635 |
+
* @since 2.01.01
|
1636 |
+
* @param {Object} childFieldArgs
|
1637 |
+
* @param {string} childFieldArgs.formId
|
1638 |
+
* @param {string} childFieldArgs.fieldId
|
1639 |
+
* @param {string} childFieldArgs.repeatRow
|
1640 |
+
* @param {object} childDiv
|
1641 |
+
*/
|
1642 |
+
function maybeShowRadioLookup( childFieldArgs, childDiv ) {
|
1643 |
+
if ( isFieldCurrentlyShown( childDiv.id, childFieldArgs.formId ) ) {
|
1644 |
+
return;
|
1645 |
+
}
|
1646 |
+
|
1647 |
+
var logicArgs = getRulesForSingleField( childFieldArgs.fieldId );
|
1648 |
+
if ( logicArgs === false || logicArgs.conditions.length < 1 ) {
|
1649 |
+
removeFromHideFields( childDiv.id, childFieldArgs.formId);
|
1650 |
+
showFieldContainer( childDiv.id );
|
1651 |
+
} else {
|
1652 |
+
logicArgs.containerId = childDiv.id;
|
1653 |
+
logicArgs.repeatRow = childFieldArgs.repeatRow;
|
1654 |
+
hideOrShowSingleField( logicArgs );
|
1655 |
+
}
|
1656 |
+
}
|
1657 |
+
|
1658 |
// Insert the loading icon
|
1659 |
function addLoadingIconJS( optContainer ) {
|
1660 |
optContainer.innerHTML = '<span class="frm-loading-img"></span>';
|
1742 |
|
1743 |
// Update a Dynamic field's data or options
|
1744 |
function updateDynamicField( depFieldArgs, onCurrentPage ) {
|
|
|
|
|
|
|
|
|
|
|
1745 |
var depFieldArgsCopy = cloneObjectForDynamicFields( depFieldArgs );
|
1746 |
|
1747 |
if ( depFieldArgsCopy.inputType == 'data' ) {
|
1748 |
+
updateDynamicListData( depFieldArgsCopy, onCurrentPage );
|
1749 |
} else {
|
1750 |
+
// Only update the options if field is on the current page
|
1751 |
+
if ( onCurrentPage ) {
|
1752 |
+
updateDynamicFieldOptions( depFieldArgsCopy );
|
1753 |
+
}
|
1754 |
}
|
1755 |
}
|
1756 |
|
1757 |
+
/**
|
1758 |
+
* Clone the depFieldArgs object for use in ajax requests
|
1759 |
+
*
|
1760 |
+
* @since 2.01.0
|
1761 |
+
* @param {Object} depFieldArgs
|
1762 |
+
* @param {string|Array} depFieldArgs.dataLogic.actualValue
|
1763 |
+
* @param {string} depFieldArgs.fieldId
|
1764 |
+
* @param {string} depFieldArgs.fieldKey
|
1765 |
+
* @param {string} depFieldArgs.formId
|
1766 |
+
* @param {string} depFieldArgs.containerId
|
1767 |
+
* @param {string} depFieldArgs.repeatRow
|
1768 |
+
* @param {string} depFieldArgs.inputType
|
1769 |
+
* @return {Object} dynamicFieldArgs
|
1770 |
+
*/
|
1771 |
function cloneObjectForDynamicFields( depFieldArgs ){
|
1772 |
var dataLogic = {
|
1773 |
actualValue:depFieldArgs.dataLogic.actualValue,
|
1776 |
|
1777 |
var dynamicFieldArgs = {
|
1778 |
fieldId:depFieldArgs.fieldId,
|
1779 |
+
fieldKey:depFieldArgs.fieldKey,
|
1780 |
formId:depFieldArgs.formId,
|
1781 |
containerId:depFieldArgs.containerId,
|
1782 |
+
repeatRow:depFieldArgs.repeatRow,
|
1783 |
dataLogic:dataLogic,
|
1784 |
children:'',
|
1785 |
inputType:depFieldArgs.inputType
|
1788 |
return dynamicFieldArgs;
|
1789 |
}
|
1790 |
|
1791 |
+
/**
|
1792 |
+
* Update a Dynamic List field
|
1793 |
+
*
|
1794 |
+
* @since 2.01
|
1795 |
+
* @param {Object} depFieldArgs
|
1796 |
+
* @param {string} depFieldArgs.containerId
|
1797 |
+
* @param {string|Array} depFieldArgs.dataLogic.actualValue
|
1798 |
+
* @param {string} depFieldArgs.fieldId
|
1799 |
+
*/
|
1800 |
+
function updateDynamicListData( depFieldArgs, onCurrentPage ){
|
1801 |
+
if ( onCurrentPage ) {
|
1802 |
+
var $fieldDiv = jQuery( '#' + depFieldArgs.containerId);
|
1803 |
+
var $optContainer = $fieldDiv.find('.frm_opt_container');
|
1804 |
+
addLoadingIcon($optContainer);
|
1805 |
+
}
|
1806 |
|
1807 |
jQuery.ajax({
|
1808 |
type:'POST',url:frm_js.ajax_url,
|
1814 |
nonce:frm_js.nonce
|
1815 |
},
|
1816 |
success:function(html){
|
1817 |
+
if ( onCurrentPage ) {
|
1818 |
|
1819 |
+
$optContainer.html(html);
|
1820 |
+
var $listInputs = $optContainer.children('input');
|
1821 |
+
var listVal = $listInputs.val();
|
1822 |
+
if (html === '' || listVal === '') {
|
1823 |
+
hideDynamicField(depFieldArgs);
|
1824 |
+
} else {
|
1825 |
+
showDynamicField(depFieldArgs, $fieldDiv, $listInputs);
|
1826 |
+
}
|
1827 |
} else {
|
1828 |
+
updateHiddenDynamicListField( depFieldArgs, html );
|
1829 |
}
|
1830 |
}
|
1831 |
});
|
1832 |
}
|
1833 |
|
1834 |
+
/**
|
1835 |
+
* Update a Dynamic dropdown, radio, or checkbox options
|
1836 |
+
*
|
1837 |
+
* @since 2.01
|
1838 |
+
* @param {Object} depFieldArgs
|
1839 |
+
* @param {string} depFieldArgs.containerId
|
1840 |
+
* @param {string} depFieldArgs.dataLogic.fieldId
|
1841 |
+
* @param {string|Array} depFieldArgs.dataLogic.actualValue
|
1842 |
+
* @param {string} depFieldArgs.fieldId
|
1843 |
+
*/
|
1844 |
function updateDynamicFieldOptions( depFieldArgs, fieldElement ){
|
1845 |
var $fieldDiv = jQuery( '#' + depFieldArgs.containerId );
|
|
|
1846 |
|
1847 |
var hiddenInput = $fieldDiv.find('select[name^="item_meta"], textarea[name^="item_meta"], input[name^="item_meta"]');
|
1848 |
var prevVal = getPrevFieldValue( hiddenInput );
|
1849 |
var defaultVal = hiddenInput.data('frmval');
|
1850 |
|
1851 |
+
addLoadingIconTemp( $fieldDiv );
|
1852 |
|
1853 |
jQuery.ajax({
|
1854 |
type:'POST',
|
1864 |
nonce:frm_js.nonce
|
1865 |
},
|
1866 |
success:function(html){
|
1867 |
+
var $optContainer = $fieldDiv.find('.frm_opt_container');
|
1868 |
$optContainer.html(html);
|
1869 |
var $dynamicFieldInputs = $optContainer.find('select, input, textarea');
|
1870 |
|
1871 |
+
removeLoadingIconTemp( $fieldDiv );
|
1872 |
+
|
1873 |
if ( html === '' || ( $dynamicFieldInputs.length == 1 && $dynamicFieldInputs.attr('type') == 'hidden' ) ) {
|
1874 |
hideDynamicField( depFieldArgs );
|
1875 |
} else {
|
1880 |
|
1881 |
}
|
1882 |
|
1883 |
+
/**
|
1884 |
+
* Update the value in a hidden Dynamic List field
|
1885 |
+
*
|
1886 |
+
* @since 2.01.01
|
1887 |
+
* @param {Object} depFieldArgs
|
1888 |
+
* @param {string} depFieldArgs.fieldKey
|
1889 |
+
* @param {string} depFieldArgs.repeatRow
|
1890 |
+
* @param {string} depFieldArgs.containerId
|
1891 |
+
* @param {string} depFieldArgs.formId
|
1892 |
+
*/
|
1893 |
+
function updateHiddenDynamicListField( depFieldArgs, newValue ) {
|
1894 |
+
// Get the Dynamic List input
|
1895 |
+
var inputId = 'field_' + depFieldArgs.fieldKey;
|
1896 |
+
if ( depFieldArgs.repeatRow !== '' ) {
|
1897 |
+
inputId += '-' + depFieldArgs.repeatRow;
|
1898 |
+
}
|
1899 |
+
var listInput = document.getElementById(inputId);
|
1900 |
+
|
1901 |
+
// Set the new value
|
1902 |
+
listInput.value = newValue;
|
1903 |
+
|
1904 |
+
// Remove field from hidden field list
|
1905 |
+
if ( isFieldConditionallyHidden( depFieldArgs.containerId, depFieldArgs.formId ) ) {
|
1906 |
+
removeFromHideFields( depFieldArgs.containerId, depFieldArgs.formId );
|
1907 |
+
}
|
1908 |
+
|
1909 |
+
triggerChange( jQuery( listInput ) );
|
1910 |
+
}
|
1911 |
+
|
1912 |
// Insert the loading icon
|
1913 |
function addLoadingIcon( $optContainer ) {
|
1914 |
$optContainer.html( '<span class="frm-loading-img"></span>' );
|
1915 |
}
|
1916 |
|
1917 |
+
// Insert the loading icon
|
1918 |
+
function addLoadingIconTemp( $fieldDiv ) {
|
1919 |
+
var currentHTML = $fieldDiv.html();
|
1920 |
+
|
1921 |
+
if ( currentHTML.indexOf( 'frm-loading-img' ) > -1 ) {
|
1922 |
+
// Loading image already present
|
1923 |
+
} else {
|
1924 |
+
var loadingIcon = '<span class="frm-loading-img"></span>';
|
1925 |
+
$fieldDiv.html( currentHTML + loadingIcon );
|
1926 |
+
|
1927 |
+
var $optContainer = $fieldDiv.find('.frm_opt_container');
|
1928 |
+
$optContainer.hide();
|
1929 |
+
}
|
1930 |
+
}
|
1931 |
+
|
1932 |
+
function removeLoadingIconTemp( $fieldDiv ) {
|
1933 |
+
var currentHTML = $fieldDiv.html();
|
1934 |
+
currentHTML = currentHTML.replace( '<span class="frm-loading-img"></span>', '' );
|
1935 |
+
$fieldDiv.html( currentHTML );
|
1936 |
+
|
1937 |
+
var $optContainer = $fieldDiv.find('.frm_opt_container');
|
1938 |
+
|
1939 |
+
$optContainer.show();
|
1940 |
+
}
|
1941 |
+
|
1942 |
+
|
1943 |
// Get the previous field value in a Dynamic field
|
1944 |
function getPrevFieldValue( inputs ) {
|
1945 |
var prev = [];
|
2109 |
totalField = getSiblingField( fieldInfo );
|
2110 |
}
|
2111 |
|
2112 |
+
if ( totalField.length < 1 ) {
|
2113 |
+
return;
|
2114 |
+
}
|
2115 |
+
|
2116 |
// loop through the fields in this calculation
|
2117 |
thisFullCalc = getValsForSingleCalc( thisCalc, thisFullCalc, all_calcs, vals, fieldInfo );
|
2118 |
|
2130 |
|
2131 |
var total = parseFloat(eval(thisFullCalc));
|
2132 |
|
2133 |
+
if ( typeof total === 'undefined' || isNaN(total) ) {
|
2134 |
total = 0;
|
2135 |
}
|
2136 |
|
2649 |
|
2650 |
var isConf = (fieldID.indexOf('conf_') === 0);
|
2651 |
if ( emailAddress !== '' || isConf ) {
|
2652 |
+
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i;
|
2653 |
var invalidMsg = getFieldValidationMessage( field, 'data-invmsg' );
|
2654 |
if ( emailAddress !== '' && re.test( emailAddress ) === false ) {
|
2655 |
errors[ fieldID ] = invalidMsg;
|
2768 |
jQuery(document.getElementById('frm_edit_'+ entryIdField.val())).find('a').addClass('frm_ajax_edited').click();
|
2769 |
}
|
2770 |
|
2771 |
+
var formCompleted = jQuery(errObj).find('.frm_message');
|
2772 |
+
if ( formCompleted.length ) {
|
2773 |
+
// if the success message is showing, run the logic
|
2774 |
+
checkConditionalLogic( 'pageLoad' );
|
2775 |
+
}
|
2776 |
checkFieldsOnPage();
|
2777 |
}else{
|
2778 |
jQuery(object).find('input[type="submit"], input[type="button"]').removeAttr('disabled');
|
2811 |
if ( $recaptcha.length ) {
|
2812 |
show_captcha = true;
|
2813 |
var recaptchaID = $recaptcha.data('rid');
|
2814 |
+
if ( jQuery().grecaptcha ) {
|
2815 |
+
if ( recaptchaID ) {
|
2816 |
+
grecaptcha.reset( recaptchaID );
|
2817 |
+
} else {
|
2818 |
+
grecaptcha.reset();
|
2819 |
+
}
|
2820 |
}
|
2821 |
}
|
2822 |
}
|
3251 |
}
|
3252 |
});
|
3253 |
|
3254 |
+
loadStars();
|
|
|
|
|
|
|
|
|
3255 |
|
3256 |
// trigger autocomplete
|
3257 |
loadChosen();
|
3300 |
$edit.html(cancel);
|
3301 |
checkConditionalLogic( 'editInPlace' );
|
3302 |
checkFieldsOnPage();
|
3303 |
+
|
3304 |
+
//TODO: Find out why this extra binding is required
|
3305 |
+
jQuery('#'+ prefix + entry_id).on('change', 'input[name^="item_meta"], select[name^="item_meta"], textarea[name^="item_meta"]', maybeCheckDependent);
|
3306 |
}
|
3307 |
});
|
3308 |
return false;
|
3358 |
checkPreviouslyHiddenFields();
|
3359 |
loadDateFields();
|
3360 |
loadCustomInputMasks();
|
3361 |
+
loadStars();
|
3362 |
loadChosen();
|
3363 |
checkDynamicFields();
|
3364 |
checkLookupFields();
|
3381 |
}
|
3382 |
}
|
3383 |
|
3384 |
+
function loadStars() {
|
3385 |
+
if ( jQuery().rating ) {
|
3386 |
+
var star = jQuery('.star');
|
3387 |
+
if ( star.length ) {
|
3388 |
+
// trigger star fields
|
3389 |
+
star.rating();
|
3390 |
+
}
|
3391 |
+
}
|
3392 |
+
}
|
3393 |
+
|
3394 |
function checkConditionalLogic( event ) {
|
3395 |
if (typeof __frmHideOrShowFields !== 'undefined') {
|
3396 |
frmFrontForm.hideOrShowFields( __frmHideOrShowFields, event );
|
3628 |
}
|
3629 |
});
|
3630 |
|
|
|
3631 |
checkConditionalLogic( 'pageLoad' );
|
3632 |
+
checkFieldsOnPage();
|
3633 |
|
3634 |
// Add fallbacks for the beloved IE8
|
3635 |
addIndexOfFallbackForIE8();
|
js/formidable.min.js
CHANGED
@@ -1,86 +1,89 @@
|
|
1 |
-
function frmFrontFormJS(){function
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
"checkbox"===a&&(this.checked?jQuery(this).closest(".frm_checkbox").children(".frm_other_input").removeClass("frm_pos_none"):jQuery(this).closest(".frm_checkbox").children(".frm_other_input").addClass("frm_pos_none").val(""))}function
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
"-0_container"];else if(d=[],f=
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
a.fieldId+"]":"item_meta["+a.fieldId+"]"}function
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
function
|
79 |
-
|
80 |
-
function
|
81 |
-
|
82 |
-
function
|
83 |
-
|
84 |
-
function
|
85 |
-
|
86 |
-
|
|
|
|
|
|
1 |
+
function frmFrontFormJS(){function l(a){var c=jQuery(this),b=c.attr("type");"submit"!==b&&a.preventDefault();a=c.parents("form:first");var d=c="",f=this.name;if("frm_prev_page"===f||-1!==this.className.indexOf("frm_prev_page"))c=jQuery(a).find(".frm_next_page").attr("id").replace("frm_next_p_","");else if("frm_save_draft"===f||-1!==this.className.indexOf("frm_save_draft"))d=1;jQuery(".frm_next_page").val(c);jQuery(".frm_saving_draft").val(d);"submit"!==b&&a.trigger("submit")}function n(){jQuery(this).parent().children(".frm_toggle_container").slideToggle("fast");
|
2 |
+
jQuery(this).toggleClass("active").children(".ui-icon-triangle-1-e, .ui-icon-triangle-1-s").toggleClass("ui-icon-triangle-1-s ui-icon-triangle-1-e")}function q(){for(var a=__frmUniqueTimes,c=0;c<a.length;c++)a[c].dateID==this.id&&frmFrontForm.removeUsedTimes(this,a[c].timeID)}function r(){if(-1===this.className.indexOf("frm_custom_date")&&"undefined"!==typeof __frmDatepicker){var a=__frmDatepicker,c=this.id,b=c.split("-");b.pop();b='input[id^="'+b.join("-")+'"]';jQuery.datepicker.setDefaults(jQuery.datepicker.regional[""]);
|
3 |
+
for(var d=0,f=0;f<a.length;f++)if(a[f].triggerID=="#"+c||a[f].triggerID==b)d=f;jQuery(this).datepicker(jQuery.extend(jQuery.datepicker.regional[a[d].locale],a[d].options))}}function w(){this.className=this.className.replace("frm_transparent","");this.parentNode.getElementsByTagName("a")[0].className.indexOf("frm_clear_file_link")}function A(){var a=this.type,c=!1,b=!1;if("select-one"===a)b=!0,"frm_other_trigger"===this.options[this.selectedIndex].className&&(c=!0);else if("select-multiple"===a)for(var b=
|
4 |
+
!0,d=this.options,c=!1,f=0;f<d.length;f++)if("frm_other_trigger"===d[f].className&&d[f].selected){c=!0;break}b?(a=jQuery(this).parent().children(".frm_other_input"),a.length&&(c?a[0].className=a[0].className.replace("frm_pos_none",""):(1>a[0].className.indexOf("frm_pos_none")&&(a[0].className+=" frm_pos_none"),a[0].value=""))):"radio"===a?jQuery(this).is(":checked")&&(jQuery(this).closest(".frm_radio").children(".frm_other_input").removeClass("frm_pos_none"),jQuery(this).closest(".frm_radio").siblings().children(".frm_other_input").addClass("frm_pos_none").val("")):
|
5 |
+
"checkbox"===a&&(this.checked?jQuery(this).closest(".frm_checkbox").children(".frm_other_input").removeClass("frm_pos_none"):jQuery(this).closest(".frm_checkbox").children(".frm_other_input").addClass("frm_pos_none").val(""))}function x(a){var c=p(this,!1);if(c&&"undefined"!==typeof c&&(!a.frmTriggered||a.frmTriggered!=c)){y(c,jQuery(this));a="undefined"!==typeof a.originalEvent||-1<a.currentTarget.className.indexOf("frm_chzn")?"value changed":"other";Z(c,jQuery(this),a);J(c,jQuery(this));c=[];a=
|
6 |
+
jQuery(this).closest(".frm_form_field");a.hasClass(".frm_required_field")&&!jQuery(this).hasClass(".frm_optional")&&(c=aa(this,c));if(1>c.length)if("email"==this.type)var b=jQuery(this).closest("form").find("input[type=email]"),c=ba(this,c,b);else"number"==this.type?c=ca(this,c):null!==this.pattern&&(c=da(this,c));a.removeClass("frm_blank_field");a.find(".frm_error").remove();if(0<Object.keys(c).length)for(var d in c)K(a,d,c)}}function p(a,c){var b="",b=a instanceof jQuery?a.attr("name"):a.name;if(""===
|
7 |
+
b)return b=a instanceof jQuery?a.data("name"):a.getAttribute("data-name"),""!==b&&b?b:0;b=b.replace("item_meta[","").replace("[]","").split("]");if(1>b.length)return 0;var b=b.filter(function(a){return""!==a}),d=b[0],f=!1;if(1===b.length||"[form"==b[1]||"[id"==b[1])return d;if(jQuery('input[name="item_meta['+d+'][form]"]').length){if(2===b.length&&"[0"==b[1])return 0;d=b[2].replace("[","");f=!0}"other"===d&&(d=f?b[3].replace("[",""):b[1].replace("[",""));!0===c&&(d=d===b[0]?d+"-"+b[1].replace("[",
|
8 |
+
""):d+"-"+b[0]+"-"+b[1].replace("[",""));return d}function y(a,c){if(!("undefined"===typeof __FRMRULES||"undefined"===typeof __FRMRULES[a]||1>__FRMRULES[a].dependents.length||null===c||"undefined"===typeof c))for(var b=__FRMRULES[a],d=E(c[0].name),f=0,e=b.dependents.length;f<e;f++)z(b.dependents[f],d)}function z(a,c){var b=L(a);if(!(!1===b||1>b.conditions.length)){var d;d=[];if(b.isRepeating)if(""!==c.repeatingSection){var f="frm_field_"+b.fieldId+"-",f=f+(c.repeatingSection+"-"+c.repeatRow+"_container");
|
9 |
+
d.push(f)}else if("0"!==b.inEmbedForm)d=M(b),d=["frm_field_"+b.fieldId+"-"+d+"-0_container"];else if(d=[],f=M(b),null!==document.getElementById("frm_field_"+f+"_container"))for(var f=document.querySelectorAll(".frm_field_"+b.fieldId+"_container"),e=0,h=f.length;e<h;e++)d.push(f[e].id);else if(d=[],f=M(b),f="frm_field_"+b.fieldId+"-"+f+"-",e=document.querySelectorAll('[id^="field_'+b.inSectionKey+'-rowid-"]'),1>e.length)d.push(f+"0_container");else for(var h=[],g=0,k=e.length;g<k;g++)h=e[g].id.split("-"),
|
10 |
+
3==h.length&&d.push(f+h[2]+"_container");else d.push("frm_field_"+b.fieldId+"_container");f=d.length;for(e=0;e<f;e++)b.containerId=d[e],ea(b,d[e]),fa(b)}}function M(a){var c="";"0"!==a.inEmbedForm?c=a.inEmbedForm:"0"!==a.inSection&&(c=a.inSection);return c}function ea(a,c){if(a.isRepeating){var b=c.replace("_container","").split("-");a.repeatRow=b[2]}else a.repeatRow=""}function fa(a){for(var c=[],b=a.conditions.length,d=0;d<b;d++)c.push(Fa(a.conditions[d],a));b=F="any"==a.anyAll?-1<c.indexOf(!0)?
|
11 |
+
a.showHide:ga(a.showHide):-1<c.indexOf(!1)?ga(a.showHide):a.showHide;c=null!==document.getElementById(a.containerId);"show"==b?"data"==a.fieldType&&a.hasOwnProperty("dataLogic")?(a={fieldId:a.fieldId,fieldKey:a.fieldKey,formId:a.formId,containerId:a.containerId,repeatRow:a.repeatRow,dataLogic:{actualValue:a.dataLogic.actualValue,fieldId:a.dataLogic.fieldId},children:"",inputType:a.inputType},"data"==a.inputType?Ga(a,c):c&&Ha(a)):!1!==B(a.containerId,a.formId)&&(G(a.containerId,a.formId),c?(c=ha(a.containerId),
|
12 |
+
ia(c,"divider"==a.fieldType||"form"==a.fieldType,a.formId),jQuery("#"+a.containerId).show()):(c=ja(a),ia(c,"divider"==a.fieldType||"form"==a.fieldType,a.formId))):N(a,c)}function L(a){return"undefined"===typeof __FRMRULES||"undefined"===typeof __FRMRULES[a]?!1:__FRMRULES[a]}function Fa(a,c){var b=L(a.fieldId),d=ka(b,c);"data"==c.fieldType&&"data"==b.fieldType?(b=!1,b=""===a.value?""===d||1==d.length&&""===d[0]?!1:!0:O(a.operator,a.value,d),c.dataLogic=a,c.dataLogic.actualValue=d,d=b):d=O(a.operator,
|
13 |
+
a.value,d);return d}function ka(a,c){var b="";if("radio"==a.inputType||"checkbox"==a.inputType)b=la(a,c),b=document.querySelectorAll('input[name^="'+b+'"]'),b="checkbox"==a.inputType?P(b):ma(b);else if(b="",!0===a.isMultiSelect)var b=la(a,c),d=document.querySelectorAll('[name^="'+b+'"]'),f=[],b=f=1==d.length&&"hidden"!=d[0].type?jQuery('[name^="'+b+'"]').val():P(d);else d="field_"+a.fieldKey,a.isRepeating&&(d+="-"+c.repeatRow),d=document.getElementById(d),null!==d&&(b=d.value);"undefined"===typeof b?
|
14 |
+
b="":"string"===typeof b&&(b=b.trim());return b}function la(a,c){var b="";return b=a.isRepeating?"item_meta["+c.inSection+"]["+c.repeatRow+"]["+a.fieldId+"]":"item_meta["+a.fieldId+"]"}function P(a){for(var c=[],b=0,d=a.length;b<d;b++)("hidden"==a[b].type||a[b].checked)&&c.push(a[b].value);0===c.length&&(c="");return c}function O(a,c,b){"undefined"===typeof b&&(b="");jQuery.isArray(b)&&-1<jQuery.inArray(c,b)&&(b=c);-1!==String(c).search(/^\s*(\+|-)?((\d+(\.\d+)?)|(\.\d+))\s*$/)&&(c=parseFloat(c),
|
15 |
+
b=parseFloat(b));return"-1"!=String(c).indexOf(""")&&O(a,c.replace(""",'"'),b)?!0:{"==":function(a,b){return a==b},"!=":function(a,b){return a!=b},"<":function(a,b){return a>b},">":function(a,b){return a<b},LIKE:function(a,b){if(!b)return!1;b=na(b);a=oa(a);return-1!=b.indexOf(a)},"not LIKE":function(a,b){if(!b)return!0;b=na(b);a=oa(a);return-1==b.indexOf(a)}}[a](c,b)}function na(a){"string"===typeof a?a=a.toLowerCase():"number"===typeof a&&(a=a.toString());return a}function oa(a){"string"===
|
16 |
+
typeof a&&(a=a.toLowerCase());return a}function ga(a){return"show"==a?"hide":"show"}function ha(a){return document.getElementById(a).querySelectorAll('select[name^="item_meta"], textarea[name^="item_meta"], input[name^="item_meta"]')}function ja(a){var c=[];"divider"==a.fieldType?(c=[],"divider"==a.fieldType&&(c=document.querySelectorAll('[data-sectionid="'+a.fieldId+'"]'))):"form"==a.fieldType?c=document.querySelectorAll('[id^="field_'+a.fieldKey+'-"]'):(c="",c=a.isRepeating?"item_meta["+a.inSection+
|
17 |
+
"]["+a.repeatRow+"]["+a.fieldId+"]":"item_meta["+a.fieldId+"]",c=document.querySelectorAll('[name^="'+c+'"]'));return c}function ia(a,c,b){if(a.length)for(var d,f=["checkbox","radio"],e=0;e<a.length;e++)if(!(0<e&&"undefined"!==typeof d&&d.name==a[e].name&&-1<f.indexOf(d.type)||c&&pa(a[e],b))){d=a[e];var h=jQuery(d),g=h.data("frmval");if("undefined"!==typeof g){if("checkbox"==d.type||"radio"==d.type)for(var k=document.getElementsByName(d.name),m=0,l=k.length;m<l;m++)if("hidden"==k[m].type)jQuery.isArray(g)&&
|
18 |
+
null!==g[m]?k[m].value=g[m]:k[m].value=g;else{if(k[m].value==g||jQuery.isArray(g)&&-1<g.indexOf(k[m].value))if(k[m].checked=!0,"radio"==k[m].type)break}else if(-1<d.name.indexOf("[]"))if(k=document.getElementsByName(d.name),jQuery.isArray(g))for(m=0,l=g.length;m<l;m++)m in k&&(k[m].value=g[m]);else k[0].value=g;else d.value=g;"SELECT"==d.tagName&&Q(d);u(h)}d=a[e];h=p(d,!1);h=R(h);!1!==h&&"lookup"!=h.fieldType&&(h.parentVals=S(h),qa(h,d));d=a[e];if(h="undefined"!==typeof __FRMCALC){h=d.type;g=!1;if("text"==
|
19 |
+
h||"hidden"==h||"number"==h)g=!0;h=g}if(h){h=__FRMCALC;g=d.name;k=d.id.replace("field_","");if(3<=g.split("][").length)for(g=k.split("-"),k="",m=0;m<g.length-1;m++)k=""===k?g[m]:k+"-"+g[m];g=k;k=null;3<=d.name.split("][").length&&(k="hidden"!=d.type?jQuery(d).closest(".frm_form_field"):jQuery(d));d=k;void 0!==h.calc[g]&&ra(h,g,[],d)}d=a[e]}}function pa(a,c){var b=p(a,!0);return B("frm_field_"+b+"_container",c)}function N(a,c){if(!B(a.containerId,a.formId)){if(c){jQuery("#"+a.containerId).hide();var b=
|
20 |
+
ha(a.containerId)}else b=ja(a);T(b);sa(a.containerId,a.formId)}}function T(a){if(!(1>a.length)){for(var c,b=!0,d=0,f=a.length;d<f;d++)0<d&&c.name!=a[d].name&&!0===b&&u(jQuery(c)),b=!0,"radio"==a[d].type||"checkbox"==a[d].type?a[d].checked=!1:"SELECT"==a[d].tagName?(0===a[d].selectedIndex?b=!1:a[d].selectedIndex=0,null!==document.getElementById(a[d].id+"_chosen")&&jQuery(a[d]).trigger("chosen:updated")):a[d].value="",c=a[d];!0===b&&u(jQuery(c))}}function B(a,c){var b=!1;-1<C(c).indexOf(a)&&(b=!0);
|
21 |
+
return b}function sa(a,c){var b=C(c);-1<b.indexOf(a)||(b.push(a),b=JSON.stringify(b),document.getElementById("frm_hide_fields_"+c).value=b)}function C(a){var c=[];a=document.getElementById("frm_hide_fields_"+a);return null===a?c:c=(c=a.value)?JSON.parse(c):[]}function G(a,c){var b=C(c),d=b.indexOf(a);-1<d&&(b.splice(d,1),b=JSON.stringify(b),document.getElementById("frm_hide_fields_"+c).value=b)}function Z(a,c,b){if(!("undefined"===typeof __FRMLOOKUP||"undefined"===typeof __FRMLOOKUP[a]||1>__FRMLOOKUP[a].dependents.length||
|
22 |
+
null===c||"undefined"===typeof c)){a=__FRMLOOKUP[a];c=E(c[0].name);for(var d=0,f=a.dependents.length;d<f;d++)U(a.dependents[d],c,b)}}function U(a,c,b){a=R(a);if(!(!1===a||1>a.parents.length))if("lookup"==a.fieldType){c=[];a.isRepeating?c=document.querySelectorAll(".frm_field_"+a.fieldId+"_container"):(b=document.getElementById("frm_field_"+a.fieldId+"_container"),null!==b&&c.push(b));b=0;for(var d=c.length;b<d;b++){ea(a,c[b].id);var f=a,e=c[b];f.parentVals=S(f);if("select"==f.inputType)Ia(f,e);else if("radio"==
|
23 |
+
f.inputType||"checkbox"==f.inputType)if(!1===f.parentVals){var h=e.getElementsByTagName("input");ta(f,e);T(h)}else Ja(f,e)}}else if("value changed"===b)for(b="field_"+a.fieldKey,b=a.isRepeating?""!==c.repeatingSection?'[id="'+b+"-"+c.repeatRow+'"]':'[id^="'+b+'-"]':'[id="'+b+'"]',c=document.querySelectorAll(b),b=0,d=c.length;b<d;b++)f=a,e=E(c[b].name),f.repeatRow=""!==e.repeatRow?e.repeatRow:"",f=a,e=c[b],f.parentVals=S(f),qa(f,e)}function R(a){return"undefined"===typeof __FRMLOOKUP||"undefined"===
|
24 |
+
typeof __FRMLOOKUP[a]?!1:__FRMLOOKUP[a]}function S(a){var c=[],b=a.parents,d;d=!1;for(var f=0,e=b.length;f<e;f++){d=R(b[f]);d=ka(d,a);if(""===d||!1===d){c=!1;break}c[f]=d}return c}function ma(a){for(var c=!1,b=a.length,d=0;d<b;d++)if("hidden"==a[d].type||a[d].checked){c=a[d].value;break}return c}function Ia(a,c){var b=c.getElementsByTagName("SELECT")[0];if(null!==b){var d=b.value;!1===a.parentVals?(b.options.length=1,""!==d&&(b.value="",Q(b),u(jQuery(b),a.fieldKey))):jQuery.ajax({type:"POST",url:frm_js.ajax_url,
|
25 |
+
data:{action:"frm_replace_lookup_field_options",parent_fields:a.parents,parent_vals:a.parentVals,field_id:a.fieldId,nonce:frm_js.nonce},success:function(c){var d=a.fieldKey,h=b.value;c=JSON.parse(c);for(var g=b.options.length;0<g;g--)b.remove(g);for(var k=c.length,g=0;g<k;g++)b.options[g+1]=new Option(c[g],c[g],!1,!1);b.value=h;""===b.value&&(c=b.getAttribute("data-frmval"),null!==c&&(b.value=c));Q(b);b.value!=h&&u(jQuery(b),d)}})}}function Q(a){-1<a.className.indexOf("frm_chzn")&&jQuery().chosen&&
|
26 |
+
jQuery(a).trigger("chosen:updated")}function Ja(a,c){var b=c.getElementsByClassName("frm_opt_container")[0],d=b.getElementsByTagName("input"),f="",f="radio"==a.inputType?ma(d):P(d);b.innerHTML='<span class="frm-loading-img"></span>';jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_replace_cb_radio_lookup_options",parent_fields:a.parents,parent_vals:a.parentVals,field_id:a.fieldId,row_index:a.repeatRow,current_value:f,nonce:frm_js.nonce},success:function(f){b.innerHTML=f;1==d.length&&
|
27 |
+
""===d[0].value?ta(a,c):!1!==B(c.id,a.formId)&&(f=L(a.fieldId),!1===f||1>f.conditions.length?(G(c.id,a.formId),jQuery("#"+c.id).show()):(f.containerId=c.id,f.repeatRow=a.repeatRow,fa(f)));u(jQuery(d[0]),a.fieldKey)}})}function ta(a,c){B(c.id,a.formId)||(jQuery("#"+c.id).hide(),sa(c.id,a.formId))}function qa(a,c){if(!pa(c,a.formId))if(!1===a.parentVals){var b=c.getAttribute("data-frmval");null===b&&(b="");ua(a,c,b)}else jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_get_lookup_text_value",
|
28 |
+
parent_fields:a.parents,parent_vals:a.parentVals,field_id:a.fieldId,nonce:frm_js.nonce},success:function(b){c.value!=b&&ua(a.fieldKey,c,b)}})}function ua(a,c,b){c.value=b;u(jQuery(c),a)}function Ga(a,c){if(c){var b=jQuery("#"+a.containerId),d=b.find(".frm_opt_container");d.html('<span class="frm-loading-img"></span>')}jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_fields_ajax_get_data",entry_id:a.dataLogic.actualValue,current_field:a.fieldId,hide_id:a.containerId,nonce:frm_js.nonce},
|
29 |
+
success:function(f){if(c){d.html(f);var e=d.children("input"),h=e.val();""===f||""===h?N(a,!0):va(a,b,e)}else e="field_"+a.fieldKey,""!==a.repeatRow&&(e+="-"+a.repeatRow),e=document.getElementById(e),e.value=f,B(a.containerId,a.formId)&&G(a.containerId,a.formId),u(jQuery(e))}})}function Ha(a,c){var b=jQuery("#"+a.containerId),d=b.find('select[name^="item_meta"], textarea[name^="item_meta"], input[name^="item_meta"]'),f=Ka(d),d=d.data("frmval");La(b);jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_fields_ajax_data_options",
|
30 |
+
trigger_field_id:a.dataLogic.fieldId,entry_id:a.dataLogic.actualValue,field_id:a.fieldId,default_value:d,container_id:a.containerId,prev_val:f,nonce:frm_js.nonce},success:function(c){var d=b.find(".frm_opt_container");d.html(c);var d=d.find("select, input, textarea"),f=b.html(),f=f.replace('<span class="frm-loading-img"></span>',"");b.html(f);b.find(".frm_opt_container").show();""===c||1==d.length&&"hidden"==d.attr("type")?N(a,!0):va(a,b,d)}})}function La(a){var c=a.html();-1<c.indexOf("frm-loading-img")||
|
31 |
+
(a.html(c+'<span class="frm-loading-img"></span>'),a.find(".frm_opt_container").hide())}function Ka(a){var c=[],b="";a.each(function(){b=this.value;"radio"===this.type||"checkbox"===this.type?!0===this.checked&&c.push(b):""!==b&&c.push(b)});0===c.length&&(c="");return c}function va(a,c,b){B(a.containerId,a.formId)&&(G(a.containerId,a.formId),c.show());b.hasClass("frm_chzn")&&V();u(b)}function J(a,c){if("undefined"!==typeof __FRMCALC){var b=__FRMCALC,d=b.fields[a];if("undefined"!==typeof d)for(var d=
|
32 |
+
d.total,f=[],e=0,h=d.length;e<h;e++){var g;g=b.calc[d[e]];var k=c.attr("name"),m=!1,l=g.field_id,n=C(g.form_id);1>n.length||("0"===g.inSection&&"0"===g.inEmbedForm?m=H(l,n):(k=E(k),H(l,n)?m=!0:wa(l,k,n)?m=!0:"0"!==g.inSection&&"0"!==g.inEmbedForm?m=wa(g.inSection,k,n):"0"!==g.inSection?m=H(g.inSection,n):"0"!==g.inEmbedForm&&(m=H(g.inEmbedForm,n))));g=m;!1===g&&ra(b,d[e],f,c)}}}function H(a,c){return-1<c.indexOf("frm_field_"+a+"_container")}function wa(a,c,b){var d=!1;c.repeatingSection&&(a="frm_field_"+
|
33 |
+
a+"-"+c.repeatingSection,a+="-"+c.repeatRow+"_container",d=-1<b.indexOf(a));return d}function ra(a,c,b,d){var f=a.calc[c],e=f.calc,h=jQuery(document.getElementById("field_"+c)),g={triggerField:d,inSection:!1,thisFieldCall:'input[id^="field_'+c+'-"]'};1>h.length&&"undefined"!==typeof d&&(g.inSection=!0,g.thisFieldId=Ma(a.fieldsWithCalc,c),h=xa(g));if(!(1>h.length)){e=Na(f,e,a,b,g);a=f.calc_dec;e.indexOf(").toFixed(")&&(b=e.split(").toFixed("),ya(b[1])&&(a=b[1],e=e.replace(").toFixed("+a,"")));e=parseFloat(eval(e));
|
34 |
+
if("undefined"===typeof e||isNaN(e))e=0;ya(a)&&(e=e.toFixed(a));h.val()!=e&&(h.val(e),u(h,c))}}function Na(a,c,b,d,f){for(var e=0,h=a.fields.length;e<h;e++){var g={triggerField:f.triggerField,thisFieldId:a.fields[e],inSection:f.inSection,valKey:f.inSection+""+a.fields[e],thisField:b.fields[a.fields[e]],thisFieldCall:"input"+b.fieldKeys[a.fields[e]]},k=b;"checkbox"==g.thisField.type||"select"==g.thisField.type?g.thisFieldCall=g.thisFieldCall+":checked,select"+k.fieldKeys[g.thisFieldId]+" option:selected,"+
|
35 |
+
g.thisFieldCall+"[type=hidden]":"radio"==g.thisField.type||"scale"==g.thisField.type?g.thisFieldCall=g.thisFieldCall+":checked,"+g.thisFieldCall+"[type=hidden]":"textarea"==g.thisField.type&&(g.thisFieldCall=g.thisFieldCall+",textarea"+k.fieldKeys[g.thisFieldId]);d=Oa(g,b,d);if("undefined"===typeof d[g.valKey]||isNaN(d[g.valKey]))d[g.valKey]=0;k="["+g.thisFieldId+"]";k=k.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1");c=c.replace(new RegExp(k,"g"),d[g.valKey])}return c}function Oa(a,c,b){if("undefined"!==
|
36 |
+
typeof b[a.valKey]&&0!==b[a.valKey])return b;b[a.valKey]=0;var d;if(!1===a.inSection)d=jQuery(a.thisFieldCall);else if(d=xa(a),null===d||"undefined"===typeof d)d=jQuery(a.thisFieldCall);if(null===d||"undefined"===typeof d||1>d.length)return b;d.each(function(){var d,e=a.thisField;d=!1;if("hidden"==this.type)""!==W(this)&&(d=!0);else if("select"==e.type){var h=this.className;h&&-1<h.indexOf("frm_other_trigger")&&(d=!0)}else("checkbox"==e.type||"radio"==e.type)&&-1<this.id.indexOf("-other_")&&0>this.id.indexOf("-otext")&&
|
37 |
+
(d=!0);d?(d=0,"select"==e.type?"hidden"==this.type?(e=!1,2<this.name.split("[").length&&(e=!0),e||(d=W(this))):d=jQuery(this).closest(".frm_other_container").find(".frm_other_input").val():"checkbox"!=e.type&&"radio"!=e.type||"hidden"==this.type||(d=W(this)),e=d):e="checkbox"!==this.type&&"radio"!==this.type||!this.checked?jQuery(this).val():this.value;"undefined"===typeof e&&(e="");d=e;if("date"==a.thisField.type){e=c.date;h=0;if(d)if("undefined"===typeof jQuery.datepicker){h="-";-1<e.indexOf("/")&&
|
38 |
+
(h="/");e=e.split(h);d=d.split(h);var g,k;g=h=k="";for(var m=0;m<e.length;m++)if("y"==e[m])g=((new Date).getFullYear()+15).toString().substr(2,2),g=d[m]>g?"19"+d[m]:"20"+d[m];else if("yy"==e[m])g=d[m];else if("m"==e[m]||"mm"==e[m])h=d[m],2>h.length&&(h="0"+h);else if("d"==e[m]||"dd"==e[m])k=d[m],2>k.length&&(k="0"+k);h=Date.parse(g+"-"+h+"-"+k)}else h=jQuery.datepicker.parseDate(e,d);e=h;null!==e&&(b[a.valKey]=Math.ceil(e/864E5))}else{e=d;""!==e&&0!==e&&(e=e.trim(),e=parseFloat(e.replace(/,/g,"").match(/-?[\d\.]+$/)));
|
39 |
+
if("undefined"===typeof e||isNaN(e)||""===e)e=0;b[a.valKey]+=e}});return b}function xa(a){if("undefined"===typeof a.triggerField)return null;var c=a.triggerField.closest(".frm_repeat_sec, .frm_repeat_inline, .frm_repeat_grid");return c.length?(a=a.thisFieldCall.replace("[id=","[id^="),c.find(a)):null}function W(a){var c="";a=document.getElementById(a.id+"-otext");null!==a&&""!==a.value&&(c=a.value);return c}function za(a){var c=!1;a=jQuery(a).find(".frm_saving_draft");a.length&&(c=a.val());return c}
|
40 |
+
function Aa(a){var c=!1,b=jQuery(a).find(".frm_next_page");if(b.length&&b.val()){var d=jQuery(a).find('input[name="form_id"]').val();a=jQuery(a).find('input[name="frm_page_order_'+d+'"]');a=a.length?a.val():0;if(!a||b.val()<a)c=!0}return c}function aa(a,c){if("hidden"==a.type)return c;var b="",d="";if("checkbox"==a.type||"radio"==a.type){var f=jQuery('input[name="'+a.name+'"]').closest(".frm_required_field").find("input:checked");jQuery(f).each(function(){b=this.value})}else if("file"==a.type)d=jQuery(a).data("fid"),
|
41 |
+
"undefined"===typeof d&&(d=p(a,!0),d=d.replace("file","")),"undefined"===typeof c[d]&&(b=Pa(d));else{d=a.className;if(-1!==d.indexOf("frm_pos_none"))return c;b=jQuery(a).val();if("string"!==typeof b)for(var f=b,b="",e=0;e<f.length;e++)""!==f[e]&&(b=f[e]);d=-1===d.indexOf("frm_other_input")?p(a,!0):p(a,!1)}""===b&&(""===d&&(d=p(a,!0)),d in c||(c[d]=D(a,"data-reqmsg")));return c}function Pa(a){var c="";jQuery('input[name="file'+a+'"], input[name="file'+a+'[]"], input[name^="item_meta['+a+']"]').each(function(){""===
|
42 |
+
c&&(c=this.value)});return c}function ba(a,c,b){var d=a.value,f=p(a,!0);if(f in c)return c;var e=0===f.indexOf("conf_");if(""!==d||e){var h=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i,g=D(a,"data-invmsg");""!==d&&!1===h.test(d)?(c[f]=g,e&&(c[f.replace("conf_","")]="")):e&&(a=a.name.replace("conf_",""),b.filter('[name="'+a+'"]').val()!==d&&(c[f]="",c[f.replace("conf_","")]=""))}return c}function ca(a,
|
43 |
+
c){var b=a.value;""!==b&&!1!==isNaN(b/1)&&(b=p(a,!0),b in c||(c[b]=D(a,"data-invmsg")));return c}function da(a,c){var b=a.value,d=D(a,"pattern");if(""!==d&&""!==b){var f=p(a,!0);f in c||(d=new RegExp("^"+d+"$","i"),!1===d.test(b)&&(c[f]=D(a,"data-invmsg")))}return c}function D(a,c){var b=a.getAttribute(c);null===b&&(b="");return b}function Qa(a,c){jQuery(a).find('input[type="submit"], input[type="button"]').attr("disabled","disabled");jQuery(a).find(".frm_ajax_loading").addClass("frm_loading_now");
|
44 |
+
"undefined"==typeof c&&jQuery(a).find('input[name="frm_action"]').val();jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:jQuery(a).serialize()+"&action=frm_entries_"+c+"&nonce="+frm_js.nonce,success:function(b){b=b.replace(/^\s+|\s+$/g,"");0===b.indexOf("{")&&(b=jQuery.parseJSON(b));if(""===b||!b||"0"===b||"object"!=typeof b&&0===b.indexOf("<!DOCTYPE")){var c=document.getElementById("frm_loading");null!==c&&(b=jQuery(a).find("input[type=file]").val(),"undefined"!=typeof b&&""!==b&&setTimeout(function(){jQuery(c).fadeIn("slow")},
|
45 |
+
2E3));b=jQuery(a).find(".frm-g-recaptcha, .g-recaptcha");b.length&&(1>jQuery(a).find(".frm_next_page").length||1>jQuery(a).find(".frm_next_page").val())&&b.closest(".frm_form_field").replaceWith('<input type="hidden" name="recaptcha_checked" value="'+frm_js.nonce+'">');a.submit()}else if("object"!=typeof b){jQuery(a).find(".frm_ajax_loading").removeClass("frm_loading_now");var f=jQuery(a).find('input[name="form_id"]').val();jQuery(a).closest("#frm_form_"+f+"_container").replaceWith(b);frmFrontForm.scrollMsg(f);
|
46 |
+
if("function"==typeof frmThemeOverride_frmAfterSubmit){var f=jQuery('input[name="frm_page_order_'+f+'"]').val(),e=jQuery(b).find('input[name="form_id"]').val();frmThemeOverride_frmAfterSubmit(e,f,b,a)}f=jQuery(a).find('input[name="id"]');f.length&&jQuery(document.getElementById("frm_edit_"+f.val())).find("a").addClass("frm_ajax_edited").click();jQuery(b).find(".frm_message").length&&X("pageLoad");Y()}else{jQuery(a).find('input[type="submit"], input[type="button"]').removeAttr("disabled");jQuery(a).find(".frm_ajax_loading").removeClass("frm_loading_now");
|
47 |
+
f=!0;jQuery(".form-field").removeClass("frm_blank_field");jQuery(".form-field .frm_error").replaceWith("");var e=!1,h=null,g;for(g in b)if(h=jQuery(a).find("#frm_field_"+g+"_container"),h.length){if(!h.is(":visible")){var k=h.closest(".frm_toggle_container");k.length&&(k=k.prev(),k.hasClass("frm_trigger")||(k=k.prev(".frm_trigger")),k.click())}h.is(":visible")&&(K(h,g,b),f=!1,h=jQuery(a).find("#frm_field_"+g+"_container .frm-g-recaptcha, #frm_field_"+g+"_container .g-recaptcha"),h.length&&(e=!0,h=
|
48 |
+
h.data("rid"),jQuery().grecaptcha&&(h?grecaptcha.reset(h):grecaptcha.reset())))}else if("redirect"==g){window.location=b[g];return}Ba(a);!0!==e&&jQuery(a).find(".frm-g-recaptcha, .g-recaptcha").closest(".frm_form_field").replaceWith('<input type="hidden" name="recaptcha_checked" value="'+frm_js.nonce+'">');f&&a.submit()}},error:function(){jQuery(a).find('input[type="submit"], input[type="button"]').removeAttr("disabled");a.submit()}})}function K(a,c,b){a.length&&a.is(":visible")&&(a.addClass("frm_blank_field"),
|
49 |
+
"function"==typeof frmThemeOverride_frmPlaceError?frmThemeOverride_frmPlaceError(c,b):a.append('<div class="frm_error">'+b[c]+"</div>"))}function Ba(a){var c=jQuery(a).find(".frm_blank_field:first");c.length&&frmFrontForm.scrollMsg(c,a,!0)}function Ra(){Ca(jQuery(this),"clear")}function Sa(){Ca(jQuery(this),"replace")}function Ca(a,c){var b=a.data("frmval").replace(/(\n|\r\n)/g,"\r");if(""===b||"undefined"==typeof b)return!1;var d=a.val().replace(/(\n|\r\n)/g,"\r");"replace"==c?""===d&&a.addClass("frm_default").val(b):
|
50 |
+
d==b&&a.removeClass("frm_default").val("")}function Ta(){var a=jQuery(this),c=a.data("eid"),b=a.data("fid");a.append('<span class="spinner" style="display:inline"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_send_email",entry_id:c,form_id:b,nonce:frm_js.nonce},success:function(b){a.replaceWith(b)}});return!1}function Ua(a,c){google.load("visualization","1.0",{packages:[c],callback:function(){if("table"==c){var b=new google.visualization.DataTable,d=!1;-1!==jQuery.inArray("id",
|
51 |
+
a.options.fields)&&(d=!0,b.addColumn("number",frm_js.id));for(var f=a.fields.length,e="string",h=0,g=f;h<g;h++){var k=a.fields[h],e=Da(k);b.addColumn(e,k.name)}h=!1;a.options.edit_link&&(h=!0,b.addColumn("string",a.options.edit_link));g=!1;a.options.delete_link&&(g=!0,b.addColumn("string",a.options.delete_link));k=0;if(null!==a.entries){var m=a.entries.length;b.addRows(m);for(var l=0,n=0;n<m;n++){var k=0,p=a.entries[n];d&&(b.setCell(l,k,p.id),k++);for(var q=0,r=f;q<r;q++){var t=a.fields[q],e=Da(t),
|
52 |
+
t=p.metas[t.id];"number"!=e||null!==t&&""!==t?"boolean"==e&&(t=null===t||"false"==t||!1===t?!1:!0):t=0;b.setCell(l,k,t);k++}h&&("undefined"!==typeof p.editLink?b.setCell(l,k,'<a href="'+p.editLink+'">'+a.options.edit_link+"</a>"):b.setCell(l,k,""),k++);g&&("undefined"!==typeof p.deleteLink?b.setCell(l,k,'<a href="'+p.deleteLink+'" class="frm_delete_link" data-frmconfirm="'+a.options.confirm+'">'+a.options.delete_link+"</a>"):b.setCell(l,k,""));l++}}else for(b.addRows(1),h=k=0,g=f;h<g;h++)0<k?b.setCell(0,
|
53 |
+
k,""):b.setCell(0,k,a.options.no_entries),k++;(new google.visualization.Table(document.getElementById("frm_google_table_"+a.options.form_id))).draw(b,a.graphOpts)}else Va(a)}})}function Da(a){var c="string";if("number"==a.type)c="number";else if("checkbox"==a.type||"select"==a.type){var b=a.options.length;"select"==a.type&&""===a.options[0]&&(b="post_status"==a.field_options.post_field?3:b-1);1==b&&(c="boolean")}return c}function Va(a){var c=new google.visualization.DataTable,b=!1,d=!1,f=a.rows.length;
|
54 |
+
if(0<f)if("table"==a.type){b=!0;c.addRows(a.rows[f-1][0]+1);for(var e=0;e<f;e++)c.setCell(a.rows[e])}else if("undefined"!=typeof a.rows[0].tooltip)for(var d=b=!0,h=0;h<f;h++){e=a.rows[h].tooltip;delete a.rows[h].tooltip;var g=Object.keys(a.rows[h]).map(function(b){return a.rows[h][b]});a.rows[h]=g;a.rows[h].push(e)}f=a.cols.length;if(b){if(0<f)for(b=0;b<f;b++)e=a.cols[b],c.addColumn(e.type,e.name);d&&(c.addColumn({type:"string",role:"tooltip"}),c.addRows(a.rows))}else{c=[[]];for(d=0;d<f;d++)c[0].push(a.cols[d].name);
|
55 |
+
c=c.concat(a.rows);c=google.visualization.arrayToDataTable(c)}d=a.type.charAt(0).toUpperCase()+a.type.slice(1)+"Chart";(new google.visualization[d](document.getElementById("chart_"+a.graph_id))).draw(c,a.options)}function Wa(){var a=jQuery(this),c=a.data("fid");a.wrap('<div class="frm_file_names frm_uploaded_files">');for(var b=a.get(0).files,d=0;d<b.length;d++)0===d?a.after(b[d].name+' <a href="#" class="frm_clear_file_link">'+frm_js.remove+"</a>"):a.after(b[d].name+"<br/>");a.hide();b=a.attr("name");
|
56 |
+
b!="item_meta["+c+"][]"&&b.replace("item_meta[","").replace("[]","").split("][");a.closest(".frm_form_field").find(".frm_uploaded_files:last").after('<input name="'+b+'" data-fid="'+c+'"class="frm_transparent frm_multiple_file" multiple="multiple" type="file" />')}function Xa(){Ya(jQuery(this).parent(".frm_uploaded_files"))}function Za(){jQuery(this).parent(".frm_file_names").replaceWith("");return!1}function $a(){var a="frm_section_"+jQuery(this).data("parent")+"-"+jQuery(this).data("key"),c=jQuery(document.getElementById(a)),
|
57 |
+
b=c.find("input, select, textarea");c.fadeOut("slow",function(){c.remove();b.each(function(){if("file"!=this.type){var a=p(this,!1);J(a,jQuery(this))}});"function"==typeof frmThemeOverride_frmRemoveRow&&frmThemeOverride_frmRemoveRow(a,c)});return!1}function ab(){if(!0===I)return!1;I=!0;var a=jQuery(this).data("parent"),c=0;if(0<jQuery(".frm_repeat_"+a).length)var b=jQuery(".frm_repeat_"+a+":last").attr("id").replace("frm_section_"+a+"-",""),c=-1<b.indexOf("i")?1:1+parseInt(b);jQuery.ajax({type:"POST",
|
58 |
+
url:frm_js.ajax_url,dataType:"json",data:{action:"frm_add_form_row",field_id:a,i:c,nonce:frm_js.nonce},success:function(b){var f=b.html,e=jQuery(f).hide().fadeIn("slow");jQuery(".frm_repeat_"+a+":last").after(e);var h=["other"],g,k,m={repeatingSection:a.toString(),repeatRow:c.toString()};jQuery(f).find("input, select, textarea").each(function(){if("file"!=this.type){if(""===this.name)return!0;g=this.name.replace("item_meta[","").split("]")[2].replace("[","");-1==jQuery.inArray(g,h)&&!1!==this.id&&
|
59 |
+
""!==this.id&&(k=jQuery("#"+this.id),h.push(g),z(g,m),U(g,m,"value changed"),y(g,k),Z(g,k,"value changed"),J(g,k))}});Ea();V();"function"==typeof frmThemeOverride_frmAddRow&&frmThemeOverride_frmAddRow(a,b);I=!1},error:function(){I=!1}});return!1}function bb(){var a=jQuery(this),c=a.data("entryid"),b=a.data("prefix"),d=a.data("pageid"),f=a.data("formid"),e=a.data("cancel"),h=a.data("fields"),g=a.data("excludefields"),k=jQuery(document.getElementById(b+c)),m=k.html();k.html('<span class="frm-loading-img" id="'+
|
60 |
+
b+c+'"></span><div class="frm_orig_content" style="display:none">'+m+"</div>");jQuery.ajax({type:"POST",url:frm_js.ajax_url,dataType:"html",data:{action:"frm_entries_edit_entry_ajax",post_id:d,entry_id:c,id:f,nonce:frm_js.nonce,fields:h,exclude_fields:g},success:function(d){k.children(".frm-loading-img").replaceWith(d);a.removeClass("frm_inplace_edit").addClass("frm_cancel_edit");a.html(e);X("editInPlace");Y();jQuery("#"+b+c).on("change",'input[name^="item_meta"], select[name^="item_meta"], textarea[name^="item_meta"]',
|
61 |
+
x)}});return!1}function cb(){var a=jQuery(this),c=a.data("entryid"),b=a.data("prefix"),d=a.data("edit");a.hasClass("frm_ajax_edited")||(c=jQuery(document.getElementById(b+c)),c.children(".frm_forms").replaceWith(""),c.children(".frm_orig_content").fadeIn("slow").removeClass("frm_orig_content"));a.removeClass("frm_cancel_edit").addClass("frm_inplace_edit");a.html(d);return!1}function db(){var a=jQuery(this),c=a.data("deleteconfirm");if(confirm(c)){var b=a.data("entryid"),d=a.data("prefix");a.replaceWith('<span class="frm-loading-img" id="frm_delete_'+
|
62 |
+
b+'"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_destroy",entry:b,nonce:frm_js.nonce},success:function(a){"success"==a.replace(/^\s+|\s+$/g,"")?(jQuery(document.getElementById(d+b)).fadeOut("slow"),jQuery(document.getElementById("frm_delete_"+b)).fadeOut("slow")):jQuery(document.getElementById("frm_delete_"+b)).replaceWith(a)}})}return!1}function Y(){"undefined"!==typeof __frmHideFields&&frmFrontForm.hidePreviouslyHiddenFields();jQuery(document).on("focusin",".frm_date",
|
63 |
+
r);if("undefined"!==typeof __frmUniqueTimes)for(var a=__frmUniqueTimes,c=0;c<a.length;c++)jQuery(document.getElementById(a[c].dateID)).change(q);if("undefined"!==typeof __frmMasks)for(a=__frmMasks,c=0;c<a.length;c++)jQuery(a[c].trigger).attr("data-frmmask",a[c].mask);Ea();V();"undefined"!==typeof __frmDepDynamicFields&&frmFrontForm.checkDependentDynamicFields(__frmDepDynamicFields);"undefined"!==typeof __frmDepLookupFields&&frmFrontForm.checkDependentLookupFields(__frmDepLookupFields);"undefined"!==
|
64 |
+
typeof __FRMCALC&&(a=__FRMCALC.triggers)&&jQuery(a.join()).trigger({type:"change",selfTriggered:!0})}function V(){if(jQuery().chosen){var a={allow_single_deselect:!0};"undefined"!==typeof __frmChosen&&(a="{"+__frmChosen+"}");jQuery(".frm_chzn").chosen(a)}}function Ea(){if(jQuery().rating){var a=jQuery(".star");a.length&&a.rating()}}function X(a){"undefined"!==typeof __frmHideOrShowFields&&frmFrontForm.hideOrShowFields(__frmHideOrShowFields,a)}function u(a,c){"undefined"===typeof c&&(c="dependent");
|
65 |
+
1<a.length&&(a=a.eq(0));a.trigger({type:"change",selfTriggered:!0,frmTriggered:c})}function E(a){var c={repeatingSection:"",repeatRow:""};"undefined"!==typeof a&&3<=a.split("][").length&&(a=a.split("]["),c.repeatingSection=a[0].replace("item_meta[",""),c.repeatRow=a[1]);return c}function Ya(a){a.fadeOut("slow",function(){a.remove()})}function eb(){var a=jQuery(this).data("frmconfirm");return confirm(a)}function fb(){var a=jQuery(this).data("frmtoggle");jQuery(a).is(":visible")?jQuery(a).slideUp("fast"):
|
66 |
+
jQuery(a).slideDown("fast");return!1}function Ma(a,c){for(var b in a)if(a.hasOwnProperty(b)&&a[b]===c)return b;return null}function ya(a){return!jQuery.isArray(a)&&0<=a-parseFloat(a)+1}function gb(){Array.prototype.indexOf||(Array.prototype.indexOf=function(a,c){var b=this.length>>>0,d=Number(c)||0,d=0>d?Math.ceil(d):Math.floor(d);for(0>d&&(d+=b);d<b;d++)if(d in this&&this[d]===a)return d;return-1})}function hb(){"function"!==typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,
|
67 |
+
"")})}function ib(){Array.prototype.filter||(Array.prototype.filter=function(a,c){if(void 0===this||null===this)throw new TypeError;var b=Object(this),d=b.length>>>0;if("function"!==typeof a)throw new TypeError;for(var f=[],e=0;e<d;e++)if(e in b){var h=b[e];a.call(c,h,e,b)&&f.push(h)}return f})}function jb(){Object.keys||(Object.keys=function(a){var c=[],b;for(b in a)a.hasOwnProperty(b)&&c.push(b);return c})}var I=!1,F="",v=[];return{init:function(){jQuery(document).off("submit.formidable",".frm-show-form");
|
68 |
+
jQuery(document).on("submit.formidable",".frm-show-form",frmFrontForm.submitForm);jQuery(document).on("click",".frm_trigger",n);var a=jQuery(".frm_blank_field");a.length&&a.closest(".frm_toggle_container").prev(".frm_trigger").click();jQuery.isFunction(jQuery.fn.placeholder)?jQuery(".frm-show-form input, .frm-show-form textarea").placeholder():jQuery(".frm-show-form input[onblur], .frm-show-form textarea[onblur]").each(function(){""===jQuery(this).val()&&jQuery(this).blur()});jQuery(document).on("focus",
|
69 |
+
".frm_toggle_default",Ra);jQuery(document).on("blur",".frm_toggle_default",Sa);jQuery(".frm_toggle_default").blur();jQuery(document.getElementById("frm_resend_email")).click(Ta);jQuery(document).on("change",".frm_multiple_file",Wa);jQuery(document).on("click",".frm_clear_file_link",Za);jQuery(document).on("click",".frm_remove_link",Xa);jQuery(document).on("focusin","input[data-frmmask]",function(){jQuery(this).mask(jQuery(this).data("frmmask").toString())});jQuery(document).on("change",'.frm-show-form input[name^="item_meta"], .frm-show-form select[name^="item_meta"], .frm-show-form textarea[name^="item_meta"]',
|
70 |
+
x);jQuery(document).on("click",'.frm-show-form input[type="submit"], .frm-show-form input[name="frm_prev_page"], .frm-show-form .frm_save_draft',l);jQuery(document).on("change",'.frm_other_container input[type="checkbox"], .frm_other_container input[type="radio"], .frm_other_container select',A);jQuery(document).on("change","input[type=file].frm_transparent",w);jQuery(document).on("click",".frm_remove_form_row",$a);jQuery(document).on("click",".frm_add_form_row",ab);jQuery(document).on("click","a[data-frmconfirm]",
|
71 |
+
eb);jQuery("a[data-frmtoggle]").click(fb);jQuery(".frm_edit_link_container").on("click","a.frm_inplace_edit",bb);jQuery(".frm_edit_link_container").on("click","a.frm_cancel_edit",cb);jQuery(document).on("click",".frm_ajax_delete",db);jQuery(".frm_month_heading, .frm_year_heading").click(function(){var a=jQuery(this).children(".ui-icon-triangle-1-e, .ui-icon-triangle-1-s");a.hasClass("ui-icon-triangle-1-e")?(a.addClass("ui-icon-triangle-1-s").removeClass("ui-icon-triangle-1-e"),jQuery(this).next(".frm_toggle_container").fadeIn("slow")):
|
72 |
+
(a.addClass("ui-icon-triangle-1-e").removeClass("ui-icon-triangle-1-s"),jQuery(this).next(".frm_toggle_container").hide())});X("pageLoad");Y();gb();hb();ib();jb()},submitForm:function(a){var c=this.classList;c&&!c.contains("frm_pro_form")||jQuery("body").hasClass("wp-admin")||(a.preventDefault(),a=frmFrontForm.validateFormSubmit(this),0===Object.keys(a).length&&frmFrontForm.checkFormErrors(this,F))},validateFormSubmit:function(a){jQuery(this).find(".wp-editor-wrap").length&&"undefined"!=typeof tinyMCE&&
|
73 |
+
tinyMCE.triggerSave();F=jQuery(a).find('input[name="frm_action"]').val();v=[];var c=jQuery(a).hasClass("frm_js_validate");c&&(za(a)||Aa(a))&&(c=!1);c&&(frmFrontForm.getAjaxFormErrors(a),Object.keys(v).length&&frmFrontForm.addAjaxFormErrors(a));return v},getAjaxFormErrors:function(a){var c=[],b=jQuery(a).find(".frm_required_field:visible input, .frm_required_field:visible select, .frm_required_field:visible textarea").filter(":not(.frm_optional)");if(b.length)for(var d=0,f=b.length;d<f;d++)c=aa(b[d],
|
74 |
+
c);b=jQuery(a).find("input[type=email]").filter(":visible");d=jQuery(a).find("input,select,textarea");if(d.length)for(var f=0,e=d.length;f<e;f++){var h=d[f];""!==h.value&&"hidden"!=h.type&&("number"==h.type?c=ca(h,c):"email"==h.type?c=ba(h,c,b):null!==h.pattern&&(c=da(h,c)))}b=jQuery(a).find(".frm-g-recaptcha");b.length&&(d=b.data("rid"),0===grecaptcha.getResponse(d).length&&(b=b.closest(".frm_form_field").attr("id").replace("frm_field_","").replace("_container",""),c[b]=""));v=c;if("function"==typeof frmThemeOverride_jsErrors&&
|
75 |
+
(a=frmThemeOverride_jsErrors(F,a),Object.keys(a).length))for(var g in a)v[g]=a[g];return v},addAjaxFormErrors:function(a){jQuery(".form-field").removeClass("frm_blank_field");jQuery(".form-field .frm_error").replaceWith("");for(var c in v){var b=jQuery(a).find("#frm_field_"+c+"_container");b.length?K(b,c,v):delete v[c]}Ba(a)},checkFormErrors:function(a,c){Qa(a,c)},scrollToID:function(a){a=jQuery(document.getElementById(a).offset());window.scrollTo(a.left,a.top)},scrollMsg:function(a,c,b){var d="",
|
76 |
+
d="undefined"==typeof c?jQuery(document.getElementById("frm_form_"+a+"_container")):"string"==typeof a?jQuery(c).find("#frm_field_"+a+"_container"):a;if(a=d.offset().top){a-=frm_js.offset;c=jQuery("html").css("margin-top");d=jQuery("body").css("margin-top");if(c||d)a=a-parseInt(c)-parseInt(d);if(a&&window.innerHeight&&(c=document.documentElement.scrollTop||document.body.scrollTop,a>c+window.innerHeight||a<c))return"undefined"===typeof b?jQuery(window).scrollTop(a):jQuery("html,body").animate({scrollTop:a},
|
77 |
+
500),!1}},savingDraft:function(a){return za(a)},goingToPreviousPage:function(a){return Aa(a)},hideOrShowFields:function(a,c){if("pageLoad"===c){var b=document.querySelectorAll('[id^="frm_hide_fields_"]');T(b)}for(var b={repeatingSection:"",repeatRow:""},d=0,f=a.length;d<f;d++)z(a[d],b)},hidePreviouslyHiddenFields:function(){var a;a=[];for(var c=document.querySelectorAll('*[id^="frm_hide_fields_"]'),b=c.length,d,f=0;f<b;f++)d=c[f].id.replace("frm_hide_fields_",""),a=a.concat(C(d));c=0;for(b=a.length;c<
|
78 |
+
b;c++)d=document.getElementById(a[c]),null!==d&&(d.style.display="none")},checkDependentDynamicFields:function(a){for(var c={repeatingSection:"",repeatRow:""},b=0,d=a.length;b<d;b++)z(a[b],c)},checkDependentLookupFields:function(a){for(var c,b={repeatingSection:"",repeatRow:""},d=0,f=a.length;d<f;d++)c=a[d],U(c,b,"value changed")},loadGoogle:function(){if("undefined"!==typeof google&&google&&google.load)for(var a=__FRMTABLES,c=Object.keys(a),b=0;b<c.length;b++)for(var d=a[c[b]],f=c[b],e=0;e<d.length;e++)Ua(d[e],
|
79 |
+
f);else setTimeout(frmFrontForm.loadGoogle,30)},removeUsedTimes:function(a,c){var b=jQuery(a).parents("form:first").find('input[name="id"]');jQuery.ajax({type:"POST",url:frm_js.ajax_url,dataType:"json",data:{action:"frm_fields_ajax_time_options",time_field:c,date_field:a.id,entry_id:b?b.val():"",date:jQuery(a).val(),nonce:frm_js.nonce},success:function(a){var b=jQuery(document.getElementById(c));b.find("option").removeAttr("disabled");if(a&&""!==a)for(var e in a)b.find('option[value="'+e+'"]').attr("disabled",
|
80 |
+
"disabled")}})},escapeHtml:function(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},invisible:function(a){jQuery(a).css("visibility","hidden")},visible:function(a){jQuery(a).css("visibility","visible")}}}var frmFrontForm=frmFrontFormJS();jQuery(document).ready(function(l){frmFrontForm.init()});
|
81 |
+
function frmRecaptcha(){for(var l=jQuery(".frm-g-recaptcha"),n=0,q=l.length;n<q;n++){var r=grecaptcha.render(l[n].id,{sitekey:l[n].getAttribute("data-sitekey"),size:l[n].getAttribute("data-size"),theme:l[n].getAttribute("data-theme")});l[n].setAttribute("data-rid",r)}}
|
82 |
+
function frmUpdateField(l,n,q,r,w){jQuery(document.getElementById("frm_update_field_"+l+"_"+n)).html('<span class="frm-loading-img"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_update_field_ajax",entry_id:l,field_id:n,value:q,nonce:frm_js.nonce},success:function(){""===r.replace(/^\s+|\s+$/g,"")?jQuery(document.getElementById("frm_update_field_"+l+"_"+n+"_"+w)).fadeOut("slow"):jQuery(document.getElementById("frm_update_field_"+l+"_"+n+"_"+w)).replaceWith(r)}})}
|
83 |
+
function frmEditEntry(l,n,q,r,w,A){console.warn("DEPRECATED: function frmEditEntry in v2.0.13 use frmFrontForm.editEntry");var x=jQuery(document.getElementById("frm_edit_"+l)),p=x.html(),y=jQuery(document.getElementById(n+l)),z=y.html();y.html('<span class="frm-loading-img" id="'+n+l+'"></span><div class="frm_orig_content" style="display:none">'+z+"</div>");jQuery.ajax({type:"POST",url:frm_js.ajax_url,dataType:"html",data:{action:"frm_entries_edit_entry_ajax",post_id:q,entry_id:l,id:r,nonce:frm_js.nonce},
|
84 |
+
success:function(z){y.children(".frm-loading-img").replaceWith(z);x.replaceWith('<span id="frm_edit_'+l+'"><a onclick="frmCancelEdit('+l+",'"+n+"','"+frmFrontForm.escapeHtml(p)+"',"+q+","+r+",'"+A+'\')" class="'+A+'">'+w+"</a></span>")}})}
|
85 |
+
function frmCancelEdit(l,n,q,r,w,A){console.warn("DEPRECATED: function frmCancelEdit in v2.0.13 use frmFrontForm.cancelEdit");var x=jQuery(document.getElementById("frm_edit_"+l)),p=x.find("a"),y=p.html();p.hasClass("frm_ajax_edited")||(p=jQuery(document.getElementById(n+l)),p.children(".frm_forms").replaceWith(""),p.children(".frm_orig_content").fadeIn("slow").removeClass("frm_orig_content"));x.replaceWith('<a id="frm_edit_'+l+'" class="frm_edit_link '+A+'" href="javascript:frmEditEntry('+l+",'"+
|
86 |
+
n+"',"+r+","+w+",'"+frmFrontForm.escapeHtml(y)+"','"+A+"')\">"+q+"</a>")}
|
87 |
+
function frmDeleteEntry(l,n){console.warn("DEPRECATED: function frmDeleteEntry in v2.0.13 use frmFrontForm.deleteEntry");jQuery(document.getElementById("frm_delete_"+l)).replaceWith('<span class="frm-loading-img" id="frm_delete_'+l+'"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_destroy",entry:l,nonce:frm_js.nonce},success:function(q){"success"==q.replace(/^\s+|\s+$/g,"")?jQuery(document.getElementById(n+l)).fadeOut("slow"):jQuery(document.getElementById("frm_delete_"+
|
88 |
+
l)).replaceWith(q)}})}function frmOnSubmit(l){console.warn("DEPRECATED: function frmOnSubmit in v2.0 use frmFrontForm.submitForm");frmFrontForm.submitForm(l,this)}
|
89 |
+
function frm_resend_email(l,n){console.warn("DEPRECATED: function frm_resend_email in v2.0");$link=jQuery(document.getElementById("frm_resend_email"));$link.append('<span class="spinner" style="display:inline"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_send_email",entry_id:l,form_id:n,nonce:frm_js.nonce},success:function(l){$link.replaceWith(l)}})};
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://formidablepro.com/donate
|
|
4 |
Tags: contact form, contact, custom form, database, email, feedback, form, forms, poll, Post, captcha, spam, survey, template, widget, multisite, form builder, form creator, form manager
|
5 |
Requires at least: 3.7
|
6 |
Tested up to: 4.5
|
7 |
-
Stable tag: 2.01.
|
8 |
|
9 |
Beautiful forms in 60 seconds. The WordPress form builder that enables you to create forms with a simple drag-and-drop interface and in-place editing.
|
10 |
|
@@ -89,6 +89,35 @@ A. Try clearing your browser cache. As plugin modifications are made, frequent j
|
|
89 |
[See more FAQs](http://formidablepro.com/formidable-faqs/ "Formidable Form FAQs")
|
90 |
|
91 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
= 2.01.0 =
|
93 |
* Allow shortcodes for the submit button label
|
94 |
* Increase the timeout for activating a license
|
4 |
Tags: contact form, contact, custom form, database, email, feedback, form, forms, poll, Post, captcha, spam, survey, template, widget, multisite, form builder, form creator, form manager
|
5 |
Requires at least: 3.7
|
6 |
Tested up to: 4.5
|
7 |
+
Stable tag: 2.01.01
|
8 |
|
9 |
Beautiful forms in 60 seconds. The WordPress form builder that enables you to create forms with a simple drag-and-drop interface and in-place editing.
|
10 |
|
89 |
[See more FAQs](http://formidablepro.com/formidable-faqs/ "Formidable Form FAQs")
|
90 |
|
91 |
== Changelog ==
|
92 |
+
= 2.01.01 =
|
93 |
+
* Use a different email regex to allow more characters, and longer TLDs
|
94 |
+
* Only load custom styles on the styler. Don't include it on the manage styles, or custom css tabs. Bad custom css can make the page uneditable.
|
95 |
+
* Fix issue preventing the option to Allow the multiple recaptchas to be turned off
|
96 |
+
* Fixed issue with white space allowed in field options when bulk editing
|
97 |
+
* Use javascript instead of jQuery to scroll after submit
|
98 |
+
* Add missing styling to make inline labels work with checkbox/radio fields
|
99 |
+
* **Pro Features:** *
|
100 |
+
* Add checkbox option to Lookup fields
|
101 |
+
* Hide empty radio/checkbox Lookup fields
|
102 |
+
* Allow autocomplete Lookup fields to populate text fields
|
103 |
+
* Add filter for setting field type used for logic 'frm_logic_FIELDTYPE_input_type'
|
104 |
+
* Prevent duplicate submissions during in-place-edit or ajax-loaded forms
|
105 |
+
* Make sure post fields show up correctly on edit
|
106 |
+
* Always show the number range options in a number field
|
107 |
+
* Fixed issue with dynamic list fields not saving a value when the visibility is set to administrator
|
108 |
+
* check for __frmDatepicker before using it. This resolves issues when using a date field with custom code.
|
109 |
+
* Strip slashes shown in an entry right after POSTing
|
110 |
+
* If a field in calculation is missing, don't break the js
|
111 |
+
* Prevent conditional loops with dropdown fields
|
112 |
+
* Fixed issue with Dynamic fields not showing up when expected, and when editing 3+ level Dynamic fields
|
113 |
+
* Remove the country field when the "other" address option is selected
|
114 |
+
* Fixed issue with required Address field on conditionally hidden page. They were still required, even when skipped.
|
115 |
+
* Fixed star fields on multi-paged ajax forms. Going back a page was showing radio buttons.
|
116 |
+
* Fixed issue with small autocomplete field, when it is hidden on page load.
|
117 |
+
* Fixed issue that allowed conditional fields to show right after hitting "save draft"
|
118 |
+
* Fixed default values inside of conditional logic
|
119 |
+
* Fixed issue preventing "none" from being selected for the date styling in the styles
|
120 |
+
|
121 |
= 2.01.0 =
|
122 |
* Allow shortcodes for the submit button label
|
123 |
* Increase the timeout for activating a license
|