validators

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roman

    #1

    validators

    Hi,

    I am relatively new to dotnet and have heard great things about form
    validation and how easy it is. While I can see some improvements compared
    with classic asp I am a bit disappointed at how inflexible it seems.

    The requirement I have is that when form fields contain invalid data, ie not
    filled in, incorrect date etc, the background color of the form field must
    be set to red until the data is valid. After playing around with the
    validators I saw this was a little bit more difficult than I thought. I
    thought the best way to go was to use the customvalidator and write my own
    server-side and client-side functions. the problem I see is that I need to
    write just as much code as I needed before (with classic asp) and code reuse
    becomes a problem.

    When I am implementing my javascript I have to use a function in the format:
    function myvalidator{sou rce, arguments}. I can set the background color of
    the textbox within this function but how do I create a generic function that
    accepts the textbox as an argument so it can be reused on every page without
    writing this function for each field that needs to be validated?

    Any advice would be appreciated.


Working...