Difference between #3 and #5 of
ClientValidation for files (modern browsers)

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) {
[...]
2 0
6 followers
Viewed: 18 769 times
Version: 1.1
Category: How-tos
Last updated by: CeBe
Created on: Dec 9, 2013
Last updated: 10 years ago
Update Article

Revisions

View all history