Give it a try, your feedback is priceless.

I choosed your validation plugin amongs all others.
My goal is to share client side and server side validation rules. I
mean that I want validation to be done on client side, but when data
is submitted on server, the same check should be done once again.
Doing things twice is painful so I want to share the same validation
rules.

I like the way your plugin works for validation and I would like to
have your opinion about the method I plan to work for forrm
validation.

On the server side I keep my templates in an xml which contains html
code of all pages. I would like to have validation rules in a seperate
tag, so it is parsed on the server side for validation and also on
client side. I first planned to use non-valid html tag but I read
everywhere that I shouldn't do that (I don't quite understand why it's
so important not to use custom tags when I see a lot of people using
flash and I think that using flash is a lot worse than producing not
w3c compliant html)  anyway, here's how it would look with an object
tag :

<object id="valiation_for_form_1" style="display: none">
 <param name="rules">
     <param name="firstname">
          <param name="required" value="true"/>
          <param name="minLenght" value="2"/>
     </param>
     <param name="lastname">
          <param name="required" value="true"/>
     </param>
 </param>
 <param name="messages">
      <param name="username">
                <param  name="required" value="Please enter a username"/>
                <param name="minLength" value="Your username must consist of at
least 2 characters"/>
 </param>
</object>


This method is quite ugly when forced to use the object tag (I even
don't know if <params> tags can embed other params tags.) I would
prefer to use custom tags.
I still have to find a way to manage custom validation functions. In
fact they would be implemented also in server side, this would be the
only thing that I'll have to manage twice.

The second option is to use a JSON object formatted using your
validate API, which would be used for both client and server side.

Which method do you think is better ? (I guess going JSON is less insane)

Using this method I would be able to send back additional error
message from server. I mean, the server side validation might have
more validation tests to do that implies database queries, those tests
could invalidate the client side form.

Maybe what I want to do is pointless or too complicated.
I'm curious to know how do you manage double client/server side
validation in your applications ?

--
Fabien Meghazi

Website: http://www.amigrave.com
Email: [EMAIL PROTECTED]
IM: [EMAIL PROTECTED]

Reply via email to