Urgent how to trim the spaces that in the text fileds?

Hi ,
I have an email field .If a  person enter the value in to the field along with space i need to validate that field by removing spaces.
I already have validation for this email field as shown below..
function isEmailValid(fld){
                    var result = true;
                    if(fld != null){
                              var r = new RegExp();
                        r.compile("^[a-z0-9_\\-\\.\\']+\\@[a-z0-9_\\-\\.]+\\.[a-z]{2,4}$","i");
                              result = r.test(fld.rawValue);
                    return result;
suggest the best how i will do that
Thanks in advance
Bharathi

Hi Bharathi,
I use this JavaScript function to trim whitespace.
function trimWhitespace(value)              
    if (value.replace)
        return value.replace(/^\s*(.*?)\s*$/, '$1');
    else
        return value;
Hope it helps,
Bruce

Similar Messages

Maybe you are looking for

  • Message Protocol for JDBC receiver adpater used in mapping lookup

    hi mates, I'm trying out the scenario explained in this blog <a href="/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler">Lookup’s in XI made simpler</a>. Since we are building a query string in the UDF and executing it, shouldn't th

  • IPod Software Updater won't work

    Every time I try to update my iPod, I get a message stating that some of my music will not transfer becuase my ipod software is to old. I downloaded the update and installed it (multiple times), but it keep getting thw same message when I try to sync

  • OS X fails, freezes desktop

    My PowerBook G4 is running OS 10.3.9. When I left it on and returned after an hour, the screen was frozen. The message that came up when I tried to restart said that OS X had failed. I was able to restart the computer. This has happened 3 times recen

  • Generate PDF into New External window

    Hi All, I have developped an application.In that I am getting the data from R/3.In my application first View displays table of data and the table row contain some invoice information when I click that Row that information would be displayed as PDFfor

  • Apple doesn't allow Mail users to open links with Chrome

    Apple doesn't allow Mail users to open links with Chrome, Chrome is the deafult browser and it seems that there is a blockage for 3rd party browser, not very nice !!!!!!