on 2/2/08 3:33 PM, Steffan A. Cline at [EMAIL PROTECTED] wrote:

> 
> on 2/1/08 1:49 PM, Jörn Zaefferer at [EMAIL PROTECTED] wrote:
> 
>> 
>> Steffan A. Cline schrieb:
>>> on 2/1/08 1:10 PM, Jörn Zaefferer at [EMAIL PROTECTED] wrote:
>>> 
>>>   
>>>> Steffan A. Cline schrieb:
>>>>     
>>>>> I have a form in multiple sections. The validation declarations are in the
>>>>> head as the demos show. Problem is that I have a section where there are
>>>>> multiple groups of dynamically created file inputs. The IDs vary and the
>>>>> types of files for each group will vary. An Id may be like this
>>>>> id="cv_fi_1_2". They are coded this way so that on the server side I can
>>>>> handle the file types appropriately. Is there a trick where I could define
>>>>> each group with it's own class or something and then tell the validator to
>>>>> handle file inputs with a certain class attribute? Or to tell it to look
>>>>> for
>>>>> a specific div ID containing the file inputs and validate them accordingly
>>>>> to the group? Here is an example
>>>>> 
>>>>> All of these are in the same form and are generated server side number
>>>>> will
>>>>> vary.
>>>>>   
>>>>>       
>>>> Is having the rules in the head a requirement? If not, it would be easy
>>>> to just add them as classes/attributes, an example is here:
>>>> http://jquery.bassistance.de/validate/demo/dynamic-totals.html
>>>> 
>>>> Though even then I'm not exactly sure if it would work, considering that
>>>> all have the same name, which is currently not supported by the
>>>> validation plugin.
>>>> 
>>>> Jörn
>>>>     
>>> The names could all be made dynamic as well. Since they are file inputs,
>>> they are uniquely handled server side. I'll look at the examples and see how
>>> it works out.
>>>   
>> Okay, great. Let me know if the issue remains.
>> 
>> Jörn
> Ok, question. On that demo link you gave me I see you have class="quantity
> required" and class="required". Where is it that you are defining what the
> rules are for that class? For example, I pointed out that I needed
> validation for individual elements. One file input is PDF only while another
> is .mpg|.mov|.fla and the other is .jpg|.gif. This is interesting though.
> I'm curious to see how you suggest doing it.
> 
> 
> Thanks
> 
> Steffan
> 

Jörn,

Would it be something like this in the head?

jQuery.validator.addClassRules({
    brochure: { accept: pdf },
    movie: { accept: mov|mpg|mpeg|fla|mp4 },
    photo: { accept: jpg|gif }
});    


Then in the body?

<input type="file" name="somethingdynamic" class="photo" />
<input type="file" name="somethingdynamic" class="movie" />
<input type="file" name="somethingdynamic" class="brochure" />


Thanks

Steffan

---------------------------------------------------------------
T E L  6 0 2 . 7 9 3 . 0 0 1 4 | F A X  6 0 2 . 9 7 1 . 1 6 9 4
Steffan A. Cline  
[EMAIL PROTECTED]                             Phoenix, Az
http://www.ExecuChoice.net                                  USA
AIM : SteffanC          ICQ : 57234309
YAHOO : Steffan_Cline   MSN : [EMAIL PROTECTED]
GOOGLE: Steffan.Cline             Lasso Partner Alliance Member
---------------------------------------------------------------



Reply via email to