Re: verify text entry in a textarea doesn't work
| From: | Jason Wong | Date: | Tue, 27 Aug 2002 16:24:35 +0000 |
| Subject: | Re: verify text entry in a textarea doesn't work | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-21392@lists.php.net to get a copy of this message | ||
On Tuesday 27 August 2002 23:26, chip.wiegand@simrad.com wrote:
> I have some error checking routines for my web forms, and they are working
> great except for one
> field, a textarea field. I am using the following code, but it does not
> give an error when the field is
> empty:
>
> if (empty($feedback))
> {
> $errmsg .= "<font color='red'><li>You might want to enter some
> comments</li></font>\n";
> }
Presumably $errmsg is not appended to because empty($feedback) is FALSE. IOW
$feedback is not empty, IOW $feedback contains something. What I'm getting at
is when trying to debug some code, use a liberal dose of common-sense and
logic.
Print it out to see what it contains. Most likely it's whitespace. To convince
yourself that it does contain something use strlen().
> I use the same type of checking on input type="text" boxes and it works
> fine.
> Any ideas why it doesn't work on a textarea field?
What HTML code are you using to display the textarea field? Make sure there
are no spaces and/or newlines in there.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Good judgement comes from experience. Experience comes from bad judgement.
-- Jim Horning
*/