1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-15 11:14:12 +02:00

Fix issue processwire/processwire-issues#349 InputfieldOptions with InputfieldSelect required field not having blank option

This commit is contained in:
Ryan Cramer
2018-02-27 10:36:05 -05:00
parent 5674af8b99
commit 8acd06646f

View File

@@ -260,7 +260,8 @@ class InputfieldSelect extends Inputfield {
reset($options);
$key = key($options);
$hasBlankOption = empty($key);
if($allowBlank && !$this->required && !$this->attr('multiple') && !$hasBlankOption) {
if($allowBlank && !$hasBlankOption && !$this->attr('multiple')
&& (!$this->required || ($this->hasFieldtype == 'FieldtypeOptions' && !$this->attr('value')))) {
$out .= "<option value=''>&nbsp;</option>";
}