Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
= 6.16 =
* New: The sanitizing for layout classes has been updated to allow `[` and `]` characters, enabling the use of basic shortcodes.
* Fix: JavaScript validation would get skipped when a form included an invisible reCAPTCHA field.
* Fix: Submit buttons would appear out of place after saving a form.
* Fix: Nothing would copy when trying to click the icon to copy a style class name.
* Fix: A white element would appear at the bottom of the plugins page.
* Fix: A Cannot read properties of undefined at removeFieldError error has been fixed.
Expand Down
2 changes: 1 addition & 1 deletion classes/controllers/FrmFormsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private static function create_submit_button_field( $form ) {
array(
'type' => FrmSubmitHelper::FIELD_TYPE,
'name' => __( 'Submit', 'formidable' ),
'field_order' => 9999,
'field_order' => FrmSubmitHelper::DEFAULT_ORDER,
'form_id' => $form->id,
'field_options' => FrmFieldsHelper::get_default_field_options( FrmSubmitHelper::FIELD_TYPE ),
'description' => '',
Expand Down
7 changes: 7 additions & 0 deletions classes/helpers/FrmSubmitHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ class FrmSubmitHelper {
*/
const FIELD_TYPE = 'submit';

/**
* Default order for submit field.
*
* @var int
*/
const DEFAULT_ORDER = 9999;

/**
* Gets submit field object.
*
Expand Down
7 changes: 5 additions & 2 deletions classes/models/FrmForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,11 +514,14 @@ private static function prepare_field_update_values( $field, $values, &$new_fiel
'name' => '',
);
foreach ( $field_cols as $col => $default ) {
$default = $default === '' ? $field->{$col} : $default;

$default = $default === '' ? $field->{$col} : $default;
$new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default;
}

if ( $field->type === 'submit' && isset( $new_field['field_order'] ) && (int) $new_field['field_order'] === FrmSubmitHelper::DEFAULT_ORDER ) {
$new_field['field_order'] = $field->field_order;
}

// Don't save the template option.
if ( is_array( $new_field['options'] ) && isset( $new_field['options']['000'] ) ) {
unset( $new_field['options']['000'] );
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ See all [Formidable Zapier Integrations](https://zapier.com/apps/formidable/inte
= 6.16 =
* New: The sanitizing for layout classes has been updated to allow `[` and `]` characters, enabling the use of basic shortcodes.
* Fix: JavaScript validation would get skipped when a form included an invisible reCAPTCHA field.
* Fix: Submit buttons would appear out of place after saving a form.
* Fix: Nothing would copy when trying to click the icon to copy a style class name.
* Fix: A white element would appear at the bottom of the plugins page.
* Fix: A Cannot read properties of undefined at removeFieldError error has been fixed.
Expand Down