Problem with textarea

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • arizal
    New Member
    • Feb 2007
    • 25

    Problem with textarea

    Hello friends,
    I am having hard time working with text area on my html form. I dont know why but i am getting some extra space on my text area. So becuase of this reasom i am also not able to validate the empty text field. THere is nothing wrong with the code but i dont know why the text area is talking extra space inside of it when form loads
    My code was initially like this [HTML] <textarea cols="55" rows="20" name="user_name "> [/HTML]

    Then after reading some problem related to it in different web forum i added some extra lines of code for text box. But still the problem exists .. I am not sure what did i di wrong. [HTML] <textarea cols="55" rows="20" name="faculty_n ame" style="margin-top: -1px; margin-bottom: -1px; margin-left: -1px; margin-right:-1px;">
    </textarea> [/HTML]

    P.S : I have few php script in this page too . But i dont think it has to do anything with this text area.

    ANy thoughts or ideas would be highly appreciated.
    Thanks
  • AricC
    Recognized Expert Top Contributor
    • Oct 2006
    • 1885

    #2
    That is a pretty big text area are you sure it is extra space? Also, if your trying to validate most of the time you want to use Trim() in what ever language your validating with to get rid of excess spaces.

    Aric

    Comment

    • arizal
      New Member
      • Feb 2007
      • 25

      #3
      I want to use a Javascript validation . But my current javascript does not checks for whitespace when i give parameters like input.text=="" or null.
      I have no idea how to solve this. Does any one have any idea to fix this..
      Thanks

      Comment

      • AricC
        Recognized Expert Top Contributor
        • Oct 2006
        • 1885

        #4
        Originally posted by arizal
        I want to use a Javascript validation . But my current javascript does not checks for whitespace when i give parameters like input.text=="" or null.
        I have no idea how to solve this. Does any one have any idea to fix this..
        Thanks
        Try:
        Code:
        function TrimString(str) {
        str = str.replace(/^[ ]+(.*)$/, ‘$1′); // Trims leading spaces
        str = str.replace(/^(.*)[ ]+$/, ‘$1′); // Trims trailing spaces
        return str;
        }
        To trim the text box.


        Aric

        Comment

        • arizal
          New Member
          • Feb 2007
          • 25

          #5
          Thanks Aric ,
          i will try that and see if that helps

          Comment

          Working...