FIX iSelectFromInputGroup not understanding bootstraps input-in-label structure

This commit is contained in:
Hamish Friedlander 2016-07-28 16:51:33 +12:00
parent b6ee213de7
commit c3ed455ec6
1 changed files with 7 additions and 1 deletions

View File

@ -480,8 +480,14 @@ JS;
foreach($parent->findAll('css', 'label') as $option) {
if($option->getText() == $value) {
$input = null;
// First, look for inputs referenced by the "for" element on this label
$for = $option->getAttribute('for');
$input = $parent->findById($for);
if ($for) $input = $parent->findById($for);
// Otherwise look for inputs _inside_ the label
if (!$input) $input = $option->find('css', 'input');
if(!$input) throw new \InvalidArgumentException(sprintf('Input "%s" cannot be found', $value));