Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkbox (Group of checkboxes) #52

Open
gs58muse opened this issue Nov 11, 2019 · 0 comments
Open

Checkbox (Group of checkboxes) #52

gs58muse opened this issue Nov 11, 2019 · 0 comments

Comments

@gs58muse
Copy link

gs58muse commented Nov 11, 2019

Hi Nicolas,

I'm testing p01-contact V1.1.6 in Get Simpe V3.15. PHP 7.2.10
When a Checkbox has more than 1 Option = "checkbox "Checkbox-Test" = one | two | five "
only the last Selected Checkbox Value will be sent via e-Mail

I think the Problem is in "P01contact_Field.php" Line 229
case 'checkbox': case 'radio':

case 'checkbox': can be in array

I changed it to:
case 'checkbox': $html .= '<div class="options">'; foreach ($this->value as $i => $v) { $selected = $this->isSelected($i) ? ' checked' : ''; $v = !empty($v) ? $v : 'Default'; $html .= '<label class="option">'; $html .= "<input id=\"{$id}_option{$i}\""; $html .= " type=\"$type\" class=\"$type\" name=\"{$name}[$i]\""; $html .= " value=\"$i\"$disabled$required$selected />$v"; $html .= '</label>'; } $html .= '</div>'; break;

Radio is (as until now):
case 'radio': $html .= '<div class="options">'; foreach ($this->value as $i => $v) { $selected = $this->isSelected($i) ? ' checked' : ''; $v = !empty($v) ? $v : 'Default'; $html .= '<label class="option">'; $html .= "<input id=\"{$id}_option{$i}\""; $html .= " type=\"$type\" class=\"$type\" name=\"{$name}\""; $html .= " value=\"$i\"$disabled$required$selected />$v"; $html .= '</label>'; } $html .= '</div>'; break;

This Fix works for me - but:
If the Checkbox-Group is a required Form-Field every Checkbox in the Group must be checked to send the Form

Greetings
Gerhard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant