Buy Now
Sign in

Prototype validation does not work if class=

benji , June 12 2008
B
benji
I've found in version 2.3.9 of chronoforms that if you put your forms like this:
<input  class="someclass" name="usuari" maxlength="50" type="text" />
it wont validate, but if you put it like this:
<input name="usuari" maxlength="50" type="text" class="someclass" />


it validates with no problmes.

So there is some problem with the recognition of fields for the case in wich you put class="" before name="" on the specification of the input.

Its been hard to find this, since was so strange that that happends. Hope you can solve this on you next release.

Thanks for this great component!.
GreyHead
Hi benji,

I'm not sure if the second 'class' attribute will be found be all browsers.

You are better not putting 'class' attributes in your form input tags at all. You can usually get the same results by using descendant selectors like 'form input'.

Bob

PS You'll find several threads about this in the forums
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
B
benji
Hi GrayHead, thanks for replying.

I actually need to put class="" atribute since the form is part of a site with lot's of diferent forms, and i need to specify the size fo the input element by using CSS, since using size="" is not usefull knowing that ff, ie7,ie6, display the form diferent using the same size, and the only way to stablish a size in pixels cross-browser is by using CSS.

So i do think this IS a important issue. I'm not putting a second class element for the input tag, i only put one. But if if i put class="" before the name="" element prototype does not validate this input, and if i put the class="" right after name="" it does work well. This is a confusing behavior, and lead me to 2 hours of wondering what was wrong with the error validation.

You guys have a great component, i hope you could improve this problem so noone else happends to have same problem than me.
B)
thank you very much.
GreyHead
Hi benji,

If you look at the code on the web page I'm pretty certain that you'll find there are two 'class' attributes.

There's no problem in what you are doing, it might just break in some browsers. It's entirely pssible to do your css without the class attribute in the input tag.

I have no idea whether Max will fix this in the future. My guess is that it will make the tag parser quite a lot more complicated. At present it just searches for the name attribute and works with that.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much