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

Revision #4 has been created by Kostas Apazidis (KonApaz) on Mar 5, 2014, 10:59:47 AM with the memo:

better approach
« previous (#3) next (#5) »

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 771 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