mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Exclude value attribute from generated file inputs.
Having a value attribute present causes HTML validation errors in HTML5 doctypes. It has no effect in other doctypes, and excluding it is always valid. Fixes #3440
This commit is contained in:
parent
8a77a31620
commit
2a8ebcea60
2 changed files with 6 additions and 1 deletions
|
@ -6018,6 +6018,10 @@ class FormHelperTest extends CakeTestCase {
|
||||||
'/div'
|
'/div'
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
|
$this->Form->request->data['Model']['upload'] = 'no data should be set in value';
|
||||||
|
$result = $this->Form->file('Model.upload');
|
||||||
|
$this->assertTags($result, array('input' => array('type' => 'file', 'name' => 'data[Model][upload]', 'id' => 'ModelUpload')));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1531,7 +1531,8 @@ class FormHelper extends AppHelper {
|
||||||
$this->_secure($secure, array_merge($field, array($suffix)));
|
$this->_secure($secure, array_merge($field, array($suffix)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->Html->useTag('file', $options['name'], array_diff_key($options, array('name' => '')));
|
$exclude = array('name' => '', 'value' => '');
|
||||||
|
return $this->Html->useTag('file', $options['name'], array_diff_key($options, $exclude));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue