Cacho wrote:
> Hi
>
> I've a form with various fields and a file field.
>
> In my validation file I did:
>
> ---------------
> fields:
>   category_id:
>     required:
>       msg:            CATEGORY_REQUIRED
>   type:
>     required:
>       msg:            TYPE_REQUIRED
>   yearofcreation:
>     sfNumberValidator:
>       nan_error:    PRODUCT_YEAROFCREATION_NOT_A_NUMBER
>       max:          2007
>       max_error:    PRODUCT_YEAROFCREATION_TOO_BIG
>   price:
>     sfNumberValidator:
>       nan_error:    PRODUCT_PRICE_NOT_A_NUMBER
>   description:
>     required:
>       msg:            PRODUCT_DESCRIPTION_REQUIRED
>     sfStringValidator:
>       min:       3
>       min_error: PRODUCT_DESCRIPTION_TOO_SHORT
>   file:
>     required:         No
>     file:             true
>     sfFileValidator
>       param:
>         mime_types:
>           - 'image/jpeg'
>           - 'image/png'
>           - 'image/x-png'
>           - 'image/pjpeg'
>         mime_types_error: ONLY_PNG_JPG
>         max_size:         1512000
>         max_size_error:   MAX_SIZE_INVALID
> --------------------
>
>
> But when I try to test it I got:
>
> Configuration file "C:\work\ws_php\agriocasion\apps\frontend/modules/
> product/validate/update.yml" specifies unregistered validator "Array"
> stack trace
>
>     * at ()
>       in SF_SYMFONY_LIB_DIR\config\sfValidatorConfigHandler.class.php
> line 415 ...
>              412.       {
>              413.         // validator hasn't been registered
>              414.         $error = sprintf('Configuration file "%s"
> specifies unregistered validator "%s"', $configFiles[0], $validator);
>              415.         throw new sfParseException($error);
>              416.       }
>              417.
>              418.       // has it already been registered?
>
>
> My question is: how is supposed should I validate a form with a file
> fields ?
>
>
> Thanks in advance
>
> C
>
>
> >
>
>   
Notice the semicolon after "sfFileValidator"

file:
    required:         No
    file:             true
    sfFileValidator*:*
      param:
        mime_types:
          - 'image/jpeg'
          - 'image/png'
          - 'image/x-png'
          - 'image/pjpeg'
        mime_types_error: ONLY_PNG_JPG
        max_size:         1512000
        max_size_error:   MAX_SIZE_INVALID


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to