ClientValidation for files (modern browsers)

Comparing #3 with #4

Revision #4 was created by Kostas Apazidis (KonApaz) Kostas Apazidis (KonApaz) on Mar 5, 2014, 10:59:47 AM.

better approach

Content

[...]
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) {
[...]