Resizing text fields

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Aug 2006
Posts: 999
Reputation: EnderX is an unknown quantity at this point 
Solved Threads: 1
EnderX EnderX is offline Offline
Posting Shark

Resizing text fields

 
0
  #1
Oct 17th, 2006
I have two questions, somewhat linked together. I'm trying to create a webform, and for a few pieces of it I'll need to be able to enter descriptions into a field. I've been requested to make the fields in question larger, much like the reply-box field here, so as to make the information within it more easily visible to the people who will have to use the form.

Question 1: Is this reply box some kind of special form input type, and if so what is it called? Is it unique to the mb, or can it be used in ordinary code?

Question 2: If this isn't something special, just an ordinary text input, then how do I resize it for vertical growth? I found the 'size' command for horizontal stretching, but that really doesn't do me much good because it still limits the user to a single visible line of code.

Thanks in advance,
-EnderX
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 214
Reputation: SnowDog is an unknown quantity at this point 
Solved Threads: 8
SnowDog's Avatar
SnowDog SnowDog is offline Offline
Posting Whiz in Training

Re: Resizing text fields

 
1
  #2
Oct 17th, 2006
It's a textarea field I think you're referring to, unless I've misunderstood e.g.:

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <div style="position:absolute; left:10px; top:10px"
  2. CLASS="somediv"><textarea name="msg" style="border:1px;
  3. border-style:solid; border-color:#FF0000" rows="4"
  4. cols="50"></textarea></div>

Obviously, you include this within your form tags.
Last edited by SnowDog; Oct 17th, 2006 at 11:00 pm. Reason: Correcting typo
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 999
Reputation: EnderX is an unknown quantity at this point 
Solved Threads: 1
EnderX EnderX is offline Offline
Posting Shark

Re: Resizing text fields

 
0
  #3
Oct 18th, 2006
Thank you for your kind assistance with this; that appears to be exactly what I want to use.

Next question-what kind of code is needed to prevent it from escaping the single-quote character? Whenever I try to look a the output, if I've included something with a single quote on it (like the word I've, for example) it comes out looking like I\'ve. Any suggestions?

Thanks in advance,
-EnderX
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 214
Reputation: SnowDog is an unknown quantity at this point 
Solved Threads: 8
SnowDog's Avatar
SnowDog SnowDog is offline Offline
Posting Whiz in Training

Re: Resizing text fields

 
0
  #4
Oct 18th, 2006
You need to use a script to strip out the unwanted codes.

In PHP you could use the preg_replace:

http://uk2.php.net/preg_replace

Or if you wanted to use JavaScript here's an example with cut-and-paste code:

http://javascript.internet.com/forms...haracters.html
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 999
Reputation: EnderX is an unknown quantity at this point 
Solved Threads: 1
EnderX EnderX is offline Offline
Posting Shark

Re: Resizing text fields

 
0
  #5
Oct 19th, 2006
Maybe I'm just doing this wrong somehow, but it's not working for me. I'm using PHP, and I tried the preg_replace() function you mentioned, but I can't get it to work for the escape characters I'm trying to eliminate. I can get it to eliminate pretty much everything else in the output I've tried checking, but nothing seems to work on the '\' character; attempts to replace it are met with errors. A single one gives something like 'cannot find ]', which is understandable; it's escaping the ']' symbol. Problem is, attempts to double the '\' character up (so as to have the first one escape the second) produce the same error. What am I doing wrong here?

Thanks in advance,
-EnderX
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 214
Reputation: SnowDog is an unknown quantity at this point 
Solved Threads: 8
SnowDog's Avatar
SnowDog SnowDog is offline Offline
Posting Whiz in Training

Re: Resizing text fields

 
0
  #6
Oct 19th, 2006
OK. preg_replace isn't the way to go - it appears that there's a bug of some sort from what I could find on the subject. Sorry for misleading you.

This definitely works, though, because this time I tested it before opening my big mouth

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. # $res is the variable containing the dirty string
  2. $mystr = str_replace('\\', '', $res);

You need to make sure you use it just before you display the string because if you pass the cleaned string, say, between pages PHP adds more of those damned backslashes.

It definitely works, though.
Last edited by SnowDog; Oct 19th, 2006 at 1:40 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC