dmeikle
May 21st, 2005, 06:30 AM
ok,
so I've come from a java background into C# for a large .net project for a client...
I've been looking at the intrinsic validation offered from Microsoft, and wasn't too happy with being bound to all the MS controls and javascript added. Plus, I am writing a lot of custom user controls that write their own input forms to the page so it kinda bypasses the runat=server inside the depths of a render() method of a control.
so I took a couple of days (what the heck, I have a couple of months due date) and have created a really sweet component that receives the HttpRequest object, looks at the Uri, loads all the validation rules from an xml file (has global overrides too, just like java struts). if the form has no reference to a posted field, it automatically checks the global configuration for reference to which Validation Class to call.
Any of you guys familiar with the struts validation at all (commons package) ? Just wondering if anyone else has done anything like this, and I'd be interested in swapping tips/tricks/ideas for other useful items.
the xml file basically looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<form-validation>
<global>
<validator name="required"
classname="com.qus.validation.FieldChecks"
method="validateRequired"
msg="errors.required"/>
<validator name="email"
classname="com.qus.validation.EmailValidator"
method="validate"
msg="email.invalid"/>
<validator name="firstname"
classname="com.qus.validation.NameValidator"
method="validate"
msg="firstname.invalid"/>
</global>
<form url="/login/default.aspx">
<validator name="email"
classname="com.qus.validation.EmailValidator"
method="validate"
msg="email.invalid"/>
<validator name="password"
classname="com.qus.validation.AlphaNumericValidator"
method="validate"
msg="password.invalid"/>
</form>
<!-- place other Uri bound forms here
<form url="/login/default.aspx">
<validator name="email"
classname="com.qus.validation.EmailValidator"
method="validate"
msg="email.invalid"/>
<validator name="password"
classname="com.qus.validation.AlphaNumericValidator"
method="validate"
msg="password.invalid"/>
</form>
-->
</form-validation>
cheers.
David Meikle
www.quantumunit.com
so I've come from a java background into C# for a large .net project for a client...
I've been looking at the intrinsic validation offered from Microsoft, and wasn't too happy with being bound to all the MS controls and javascript added. Plus, I am writing a lot of custom user controls that write their own input forms to the page so it kinda bypasses the runat=server inside the depths of a render() method of a control.
so I took a couple of days (what the heck, I have a couple of months due date) and have created a really sweet component that receives the HttpRequest object, looks at the Uri, loads all the validation rules from an xml file (has global overrides too, just like java struts). if the form has no reference to a posted field, it automatically checks the global configuration for reference to which Validation Class to call.
Any of you guys familiar with the struts validation at all (commons package) ? Just wondering if anyone else has done anything like this, and I'd be interested in swapping tips/tricks/ideas for other useful items.
the xml file basically looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<form-validation>
<global>
<validator name="required"
classname="com.qus.validation.FieldChecks"
method="validateRequired"
msg="errors.required"/>
<validator name="email"
classname="com.qus.validation.EmailValidator"
method="validate"
msg="email.invalid"/>
<validator name="firstname"
classname="com.qus.validation.NameValidator"
method="validate"
msg="firstname.invalid"/>
</global>
<form url="/login/default.aspx">
<validator name="email"
classname="com.qus.validation.EmailValidator"
method="validate"
msg="email.invalid"/>
<validator name="password"
classname="com.qus.validation.AlphaNumericValidator"
method="validate"
msg="password.invalid"/>
</form>
<!-- place other Uri bound forms here
<form url="/login/default.aspx">
<validator name="email"
classname="com.qus.validation.EmailValidator"
method="validate"
msg="email.invalid"/>
<validator name="password"
classname="com.qus.validation.AlphaNumericValidator"
method="validate"
msg="password.invalid"/>
</form>
-->
</form-validation>
cheers.
David Meikle
www.quantumunit.com