How to validate textarea?

  • Thread starter Thread starter brett
  • Start date Start date
B

brett

If I try to use a RequiredFieldValidator control to make sure a
textarea isn't empty, I get an error similar to

Unable to find control id 'comment' referenced by the
'ControlToValidate' property of 'rvfComment'.

I'm guessing this control does not validate a textarea. What else can
I do for this besides checking its length on postback?

Thanks,
Brett
 
By textarea do you mean the non-.NET <textarea> or the appropriate
<asp:TextBox TextMode="MultiLine">?

You need to be using the latter...
 
You are right. I was using the wrong element.

This is what I had:
<TEXTAREA id="txtcomment" name="comment" rows="5" wrap="soft" cols="50"
runat="server"></TEXTAREA>

You can see it is runat="server". I grabbed it off the VS.NET toolbar.
If this is a regular HTML textarea, how can it runat server?

Thanks,
Brett
 
For some reason, the validation works on my local machine but not on
the server. It will validate everything but once all of the fields are
valid and I click submit, nothing happens. The submit seems to be
disabled on the server after valid data has been entered. What may be
happening?

Thanks,
Brett
 
Hi Brett,

Check .NET Framework version in your server. It might be different from the
version in your developing machine. And installing framework sp1 may solve
the problem.

HTH

Elton Wang
 
What I mean is that in both server and your local machine you have
Framework Version:1.1.4322. But they might be little bit different. For
example, in server it’s Framework Version:1.1.4322.573. But in local machine
it’s Framework Version:1.1.4322.2XXX.

Elton
 
If that really is the problem, what is the resolve for that? I don't
have access to the ASP.NET admin on the share.

Thanks,
Brett
 
In our case, we installed .NET Framework 1.1 SP1 on server. The version info
is like:

Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
Version:1.1.4322.2032

That solved the problem.

HTH

Elton
 
Back
Top