Thursday, January 31, 2008

Using CustomValidator to Validate empty (blank) Textbox

I started my page by using a RequiredFieldValidator, but later found that I needed to validate on more complex criteria as well as if the field is empty. When I added the CustomValidator I found that my code was not firing if the TextBox was empty. After researching this I found that there is a property of the CustomValidator called ValidateEmptyText. The default is false. Once I set this to true it worked and I was able to remove the RequiredFieldValidator.

I'm not sure which version of .Net this property exists in. My page was running on .Net 2.0.

Friday, January 11, 2008

Checking the Value of an HTML Checkbox in Classic ASP with VBScript

I spent several hours being rolled around by this. It appears as though that when you do request.Form("Control") the parameter takes the value of the name property and not the value of the ID property. So I got myself confused since I was doing some stuff client side in javascript as well as in VBScript server side. I generally use getElementById in javascript.

I was only setting the ID property and trying to use the request object to find the id.