Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RequiredFieldValidator works on client but not on server 1

Status
Not open for further replies.

waely

Programmer
Dec 7, 2003
227
US
hi,
I have this code to validate user email address. my RequiredFieldValidator shouldn't let me submit my email if it's blank but it's not doing that. it works locally but not when I upload it to the server. here is the code:

----------------------------------------
<asp:textbox id="txtjoinemail" Runat="server"></asp:textbox>&nbsp;
<asp:button id="join" runat="server" Text="Join" BorderStyle="Double"></asp:button>
<asp:RequiredFieldValidator id="RequiredFieldValidator3" Runat="server" ControlToValidate="txtjoinemail" ErrorMessage="*"></asp:RequiredFieldValidator>
<asp:regularexpressionvalidator id="Regularexpressionvalidator1" Runat="server" ValidationExpression="^[\w\.\-_]+@([\w\.\-_]+\.)+[A-Za-z]{2,4}$" ControlToValidate="txtjoinemail">Invalid Email Format</asp:regularexpressionvalidator>
-----------------------------------------

any thoughts?
thanks in advance
 
Hi there!
Upload the "aspnet_client" folder on the server too. You will find it on your machine in c:\inetpub\ (assuming that c: is the system-drive).

[morning]
 
I placed the folder on the server but it's still not working....

thanks
 
You'll have to upload the folder on your application root.
Something like, if you have this folder-tree:
-root
- folder1
- folder2
- folder3
- folder4
and your .aspx file that uses the validator is inside "folder3" (or anywhere else), your "aspnet_client" folder will need to be uploaded to "root".

[morning]
 
<asp:RequiredFieldValidator id="RequiredFieldValidator3" Runat="server" ControlToValidate="txtjoinemail" ErrorMessage="*"></asp:RequiredFieldValidator>

How about making RequiredFieldValidator all lower case?

<asp:requiredfieldvalidator id="RequiredFieldValidator3" Runat="server" ControlToValidate="txtjoinemail" ErrorMessage="*"></asp:requiredfieldvalidator>

Worth a try.
Marty

 
my previouse codes(capital letters) workd locally. I don't see how it would make a difference but as you said I'll give it a try
thx
 
waely:
Please see the bottom of this thread thread855-705261
I thought of your post when I read it. What I do not understand why the popup box stating copy the *.js file to your root folder or run aspnet_regiis -c does not pop up.
Marty
 
thanks cappmgr. I went ahead and used client side validation.
 
Another thought -

Are you by any chance using:

Code:
btnButton.attributes.add("onclick","javascript:alert('hi');")

or anything like it on your page? There was a bug in the Framework 1.0 that didn't allow validator controls to work if you were using code like the statement above. It was fixed in Framework 1.1. If by any chance you have Framework 1.1 on your local machine but your server was not updated, you might run into this behaviour.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top