Add support for Widgets with checkboxes that use the trick of hidden/checkbox fields with the same name (fixes #1014)

This commit is contained in:
Djamil Legato
2016-06-08 17:09:50 -07:00
parent 63923b52b4
commit ed97c4e396
4 changed files with 25 additions and 0 deletions
+1
View File
@@ -34,6 +34,7 @@
3. [WordPress](#wordpress)
2. [](#improved)
- Gantry 5 Particle Widget is now compatible with WordPress Customizer and will live-refresh on change (#869)
- Add support for Widgets with checkboxes that use the trick of hidden/checkbox fields with the same name (#1014)
# 5.2.18
## 27/05/2016
@@ -161,6 +161,12 @@ var StepTwo = function(data, content, button) {
if (!name || input.disabled() || (type == 'radio' && !input.checked())) { return; }
input = content.find('[name="' + name + '"]' + (type == 'radio' ? ':checked' : ''));
// workaround for checkboxes trick that has both a hidden and checkbox field
if (type === 'checkbox' && content.find('[type="hidden"][name="' + name + '"]')) {
input = content.find('[name="' + name + '"][type="checkbox"]');
}
var value = input.type() == 'checkbox' ? Number(input.checked()) : input.value(),
parent = input.parent('.settings-param'),
override = parent ? parent.find('> input[type="checkbox"]') : null;
@@ -133,6 +133,12 @@ ready(function() {
if (!name || input.disabled() || (type == 'radio' && !input.checked())) { return; }
input = content.find('[name="' + name + '"]' + (type == 'radio' ? ':checked' : ''));
// workaround for checkboxes trick that has both a hidden and checkbox field
if (type === 'checkbox' && content.find('[type="hidden"][name="' + name + '"]')) {
input = content.find('[name="' + name + '"][type="checkbox"]');
}
var value = value = input.type() == 'checkbox' ? Number(input.checked()) : input.value(),
parent = input.parent('.settings-param'),
override = parent ? parent.find('> input[type="checkbox"]') : null;
+12
View File
@@ -5025,6 +5025,12 @@ var StepTwo = function(data, content, button) {
if (!name || input.disabled() || (type == 'radio' && !input.checked())) { return; }
input = content.find('[name="' + name + '"]' + (type == 'radio' ? ':checked' : ''));
// workaround for checkboxes trick that has both a hidden and checkbox field
if (type === 'checkbox' && content.find('[type="hidden"][name="' + name + '"]')) {
input = content.find('[name="' + name + '"][type="checkbox"]');
}
var value = input.type() == 'checkbox' ? Number(input.checked()) : input.value(),
parent = input.parent('.settings-param'),
override = parent ? parent.find('> input[type="checkbox"]') : null;
@@ -8946,6 +8952,12 @@ ready(function() {
if (!name || input.disabled() || (type == 'radio' && !input.checked())) { return; }
input = content.find('[name="' + name + '"]' + (type == 'radio' ? ':checked' : ''));
// workaround for checkboxes trick that has both a hidden and checkbox field
if (type === 'checkbox' && content.find('[type="hidden"][name="' + name + '"]')) {
input = content.find('[name="' + name + '"][type="checkbox"]');
}
var value = value = input.type() == 'checkbox' ? Number(input.checked()) : input.value(),
parent = input.parent('.settings-param'),
override = parent ? parent.find('> input[type="checkbox"]') : null;