For the googolth time, I've been asked to retrieve form values and generate client-side validation after a user has changed some page information on-the-fly.
I like this type of feature. To me it seems user-helpful and I feel it makes forms more usable, particularly complex ones.
But - I've done it so many times before. And, clearly, I'm sooo lazy.
So, I wrapped up the kitchen sink into an object in Javascript, made some getter and setters, and made it extensible.
An ExtendedForm class.
(See the example.)Please, go visit. Use it as often as you like. It's free. And it includes a single method which allows it to check whether or not any changes have been made to the form before submitting.
Other things I like about it include:
- I no longer have to write methods figuring out how to get values from radio buttons and drop-downs. It knows for me.
- The object can be extended to support application-level validation methods.
- I don't have to worry if the <form> fields have NAME or ID attributes. If it can't find one, it'll look for the other.
- By developing a very tiny API it makes it easier to integrate within existing architectures and manage element-access methods so they conform to web standards.
It's pretty great! Though, not perfect. Like you.
Oh - I'm afraid I might sing "Man in the Mirror" to all of you.
Again.
Comments
wow, thanks i am going to try your code, i'm glad i stopped at your blog
Posted by: c0d3gr1 at September 11, 2003 09:06 PM
«·´`·.(*·.¸(`·.¸ ¸.·´)¸.·*).·´`·»
«·´¨*·.¸¸.*Aiya meldonya!!*.¸¸.·*¨`·»
«·´`·.(¸.·´(¸.·* *·.¸)`·.¸).·´`·»
~Essenya ná Lúthien~
A Elentári Tintalle
silmarin penda mírea
menello alcar eldion!
Haiyanna palantírina
aldarembie endorillor
Fanoiolosse, len linduvan
nive ear, simen nive earon!
^^^^^^^^^#####^^^^^^^^^^#####^^^^^^^^^^
^^^^^^^#########^^^^^^#########^^^^^^^^
^^^^^^############^^############^^^^^^^
^^^^^############################^^^^^^
^^^^^############################^^^^^^
^^^^^############################^^^^^^
^^^^^^##########################^^^^^^^
^^^^^^^########################^^^^^^^^
^^^^^^^^^####################^^^^^^^^^^
^^^^^^^^^^^################^^^^^^^^^^^^
^^^^^^^^^^^^^############^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^########^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^####^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^##^^^^^^^^^^^^^^^^^^^
«·´`·.(*·.¸(`·.¸ ¸.·´)¸.·*).·´`·»
«·´¨*·.¸¸.*Namárië*.¸¸.·*¨`·»
«·´`·.(¸.·´(¸.·* *·.¸)`·.¸).·´`·»
Post a comment