Changes
Title
unchanged
ClientValidation for files (modern browsers)
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
ClientValidation, file, before, uploading, model, browsers
Content
changed
[...]
add this
```php
$infoFieldFile = (end($form->attributes));
//or $infoFieldFileID = CHtml::activeId($model, 'file');
```
right below of the $form->error($model, 'file'....[...]
<script>
function customValidateFile(messages){
var nameC= '#<?php echo $infoFieldFile['inputID']; ?>';
//or var nameC= '#<?php echo $infoFieldFileID; ?>';
var control = $(nameC).get(0);
//simulates the required validator and allowEmpty setting of the file validator
if (control.files.length==0) {[...]