Wednesday, March 15, 2006

Thoughts on Validators

I have two pages requiring extensive validation, Orderinfo and Deskcopy. I have used .Net validators in Orderinfo. They are very handy, but like most .Net tools are very geared towards specific uses. So you end up modifying your code to be more like those cases instead of how you want it to be. Anyway another problem I had was with Display="Dymnamic". It didn't seem to work, some of the time. The whole client side validation seemed slightly flaky. Asterisks would sometimes stay put and sometimes shift around. And for the phone and fax numbers there would be 1-3 asterisks since each number was 3 separate controls. I suppose the right thing in this case is to make each number a single control. The only reason I haven't done that is because I have been trying to 'stay true' to the design of the original site. But again this is an example of having your code forced into a pattern that Microsoft likes.

So with Deskcopy the problem is slightly different. It requires conditional validation. Conditional validation is no problem IF you have the condition change trigger a POST. The page as written has no POST here since the fields appear via Javascript and DHTML. So to use the validators I would again be forced to alter my code to a more Microsoft friendly way. Or I could use Javascript validation. This of course, is less secure since it can easily be gotten around, but in this case I don't care. But the greater sin is that it would then no longer match the Orderinfo page. *sigh*

I will put it up without validations on this page for now and either use Javascript validation for both pages or do a POST when the checkbox on Deskcopy if checked to enable Validators. The second way is probably easier, cleaner, and more secure but at the cost of a page reload.

When Ajax style technology is more heavily incorporated it will be nice. Before that you are going to have low performing pages that flash and reloads without any purpose. And .Net tries to guide you to that style of doing things. Probably because their product lives on the server and client side scripting is beyond their dominion.

0 Comments:

Post a Comment

<< Home