-
[2005] Contact Us Web Page!
Hi All,
I have created a Contact Us web page and got all my text boxes on and a button control. In the button click event I want to check to see if all textboxes have valid data and if not prompt the user. Does anyone know how I do this. I think I am trying to do it as if I was doing it in VB.Net.
Cheers for any help,
Jiggy!
-
Re: [2005] Contact Us Web Page!
You can use RequiredFieldValidators in your markup to make sure all required fields are entered.
Then you can use a variety of other validators to check that valid data has been input such as RegularExpressionValidator & RangeValidator.
The validators generate javascript that can stop the page submitting and display messages to the user.
You still need to make sure they are valid in the back end in case javascript is disabled and you can do this using as follows and it will display the same messages but obviously requires a post back.
Code:
if Page.IsValid then...
-
Re: [2005] Contact Us Web Page!
-
Re: [2005] Contact Us Web Page!
You can use a ValidationSummary control as well in conjunction with those validators to display the messages in a DIV or an alert box.
-
Re: [2005] Contact Us Web Page!
Thank you both very much! I found a video clip on how to do it. The only thing I need to do now is the email bit on the button successfully click event. Here is the link (I hope its OK to do this on here):-
http://www.wonderhowto.com/how-to/vi...sp-net-214559/
Thanks again.
-
Re: [2005] Contact Us Web Page!
I don't know what that video says, but to send an email in ASP.NET:
http://aspnet.4guysfromrolla.com/articles/072606-1.aspx
-
Re: [2005] Contact Us Web Page!
-
Re: [2005] Contact Us Web Page!
Hi Mate,
The examples both use smtp settings. How will I know everyones smtp details. This is a stupid question I know but I don't understand.
Cheers,
Jiggy!
-
Re: [2005] Contact Us Web Page!
You don't need everyone's SMTP details. Just the SMTP details available to your server, since it's your server doing the actual sending, not those people. All they're doing is submitting a form.
-
Re: [2005] Contact Us Web Page!
I C! I have setup my SMTP details in the web.config file. ie. username, password, host, port but I get an error saying replay not allowed use SMTP AUTH. Do you know what this means?
-
Re: [2005] Contact Us Web Page!
I suspect it is relay not allowed rather than replay.
By default most SMTP servers will not act as an open relay (sending emails from unathenticated email addresses).
This thread should prove useful from about post #8 and down.
-
Re: [2005] Contact Us Web Page!
Hi Mate,
Thanks for that, I am still confused because I have put all the details in my web.config file the same as I have in my Outlook account. Also I am running this from my development PC with no server etc. I want to test it here and then it will go on a web server when its all finished.
Any points please,
Cheers again,
Jiggy!
-
Re: [2005] Contact Us Web Page!
Are you using Exchange as your mail server?
-
Re: [2005] Contact Us Web Page!
No I don't think so, I use outlook 2003.
-
Re: [2005] Contact Us Web Page!
You need to know what your SMTP server is. If you don't know, then ask an administrator.
Simply installing SMTP Server on your machine may not work, it's usually best to use your organization's SMTP Server as they may have their own scanners, etc. (Future proofing).
-
Re: [2005] Contact Us Web Page!
Sorry but now I am really lost! I have checked in outlook for my smtp address and put this in my web.config as the host. I have also give it the username, password, and port for my account.
-
Re: [2005] Contact Us Web Page!
Your outlook address is not necessarily your SMTP server address. Are you in an office? Organizations usually have an Exchange server which is what your Outlook would be using.
-
Re: [2005] Contact Us Web Page!
No mate, I work from home on a standalone PC with broadband connection.
-
Re: [2005] Contact Us Web Page!
I changed my Host to localhost in my webconfig and I went to IIS Manage and set 127.0.0.1 to granted for the relay and now I don't get an error but also don't get any emails.
-
Re: [2005] Contact Us Web Page!
It's possible that these emails are now all sitting in c:\inetpub\mailroot. The point of a relay is that it actually receives the emails and forwards (relays) it to another server to send.
If you are at home, then your ISP may have an SMTP server that you could use. You'll have to ask them. If not, if you have a web host, then your web host will have an SMTP server that you can use. most web hosts do. Again, ask them.
-
Re: [2005] Contact Us Web Page!
Cheers mate, yes I think I do have a web host. I have a domain call www.rppresolve-it.net.
-
Re: [2005] Contact Us Web Page!
Who is your host? Is it Calco UK?
-
Re: [2005] Contact Us Web Page!
Hi Mate,
My host is streamline.net. I have another problem; I have put the validator control on which works great but I cannot click on any of my buttons to leave the contact us page.
Cheers,
Jiggy!
-
Re: [2005] Contact Us Web Page!
Set the CausesValidation property of the 'cancel' button(s) to false.
-
Re: [2005] Contact Us Web Page!
I'm looking at their support site. They have sample scripts you can use to send emails:
http://www.streamlinesupport.net/ind...bid=59&catid=6
-
Re: [2005] Contact Us Web Page!
Thanks mate, I will look into that and let you know how I get on! Also thanks for the other solution; I found it in the end.
-
Re: [2005] Contact Us Web Page!