943,600 Members | Top Members by Rank

Ad:
Oct 17th, 2006
0

Resizing text fields

Expand Post »
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
Similar Threads
Reputation Points: 483
Solved Threads: 1
Posting Shark
EnderX is offline Offline
999 posts
since Aug 2006
Oct 17th, 2006
1

Re: Resizing text fields

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
Reputation Points: 32
Solved Threads: 9
Posting Whiz in Training
SnowDog is offline Offline
214 posts
since Oct 2006
Oct 18th, 2006
0

Re: Resizing text fields

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
Reputation Points: 483
Solved Threads: 1
Posting Shark
EnderX is offline Offline
999 posts
since Aug 2006
Oct 18th, 2006
0

Re: Resizing text fields

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
Reputation Points: 32
Solved Threads: 9
Posting Whiz in Training
SnowDog is offline Offline
214 posts
since Oct 2006
Oct 19th, 2006
0

Re: Resizing text fields

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
Reputation Points: 483
Solved Threads: 1
Posting Shark
EnderX is offline Offline
999 posts
since Aug 2006
Oct 19th, 2006
0

Re: Resizing text fields

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.
Reputation Points: 32
Solved Threads: 9
Posting Whiz in Training
SnowDog is offline Offline
214 posts
since Oct 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: a just started i need help
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Print button using rollover images





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC