By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,738 Members | 1,328 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,738 IT Pros & Developers. It's quick & easy.

Problem with textarea

P: 25
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_name" 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
Feb 17 '07 #1
Share this Question
Share on Google+
4 Replies

Expert 100+
P: 1,892
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
Feb 17 '07 #2

P: 25
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
Feb 18 '07 #3

Expert 100+
P: 1,892
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:
Expand|Select|Wrap|Line Numbers
  1. function TrimString(str) {
  2. str = str.replace(/^[ ]+(.*)$/, $1′); // Trims leading spaces
  3. str = str.replace(/^(.*)[ ]+$/, $1′); // Trims trailing spaces
  4. return str;
  5. }
  6.  
To trim the text box.


Aric
Feb 18 '07 #4

P: 25
Thanks Aric ,
i will try that and see if that helps
Feb 19 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.