validate form - trim fields

I have an onchange event that trims this paticular field.  I can add this to each tag or is there a way that I can have this automatically implemented across all html fields.

<td align="right" nowrap class="faxtext">Address Description: <textarea name="CONTACT_ADDR_DESCR" id="CONTACT_ADDR_DESCR" onchange="trim('CONTACT_ADDR_DESCR', this.value)" cols="32" rows="6" >Location Specific - Directions</textarea></td>
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try this jquery sample.
It will add change event for all 'textarea' controls on the page and trim.
If you are not familiar with jquery:
<html xmlns="">
<head runat="server">
    <script src="scripts/jquery-1.4.2.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $('textarea').change(function () {
    <form id="form1" runat="server">
        <textarea id="TextArea1" cols="20" rows="2"></textarea><br />
        <textarea id="TextArea2" cols="20" rows="2"></textarea><br />
        <textarea id="TextArea3" cols="20" rows="2"></textarea><br />

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
try putting these in the head of your document:
sorry, it got cut off. This is what I had:
<script src=""></script>
	<script type="text/javascript">
			$(this).val( $.trim($(this).val() ) );

Open in new window

i hope you do validation while submitting the form, so the trimming there (form onsubmit or button onclick)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.