![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Web Design & Programming Discussion of web design, and server-side & client-side scripting |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
|
Looking for some help on programming required fields into my forms on my sites. I only know html and CSS and a little bit of Javascript.
I've designed a form here - http://www.stereofx.net/promo/promo.htm I've marked some fields with a * saying that they are required fields, just to kind of fool people for now untill I can actually program it. Any help here would be greatly appreciated. I have searched a bit on the net and found it can be done with C#.net programming - but I wouldn't know where to start.... Thanks. |
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,876
OS: Vista, various linux distros
|
Re: Forms > Required Fields
Hey, you can make your fields required in JS... Heres the basics:
Imagine this in the HEAD of your page... HTML Code:
<script language="javascript" type="text/javascript"> function validateForm(){ //if this function returns false to the onsubmit event the form will not submit, if it returns true it will submit. //so get the fields: var nameField = document.getElementById("namefield"); //I'm using namefield as an example above, do the same for all the other required fields //then check that the value isn't "" (and empty string) if(nameField.value == ""){ //if it is blank //return false to stop the form from submitting return false; //you could also output some form of error (i use alert here as a basic example, personally i'd set up a div, and make it fixed in the center of the screen and have that contain the error)... alert("You have not entered your name"); } //again do the same for each of the fields //... } </script> HTML Code:
<form action="http://formmail.servage.net/" method="POST" onsubmit="validateForm();">
Anyway: Have a look at this. Cheers, Jamey Last edited by jamiemac2005; 03-31-2009 at 07:37 AM. |
|
|
|
|
|
#3 (permalink) |
|
Registered User
|
Re: Forms > Required Fields
Thanks Jamey. The JS seems a little hectic but will definitely give it a go. Should take me a few days to come right.
As for the errors on my page, well, dreamweaver is righting the code for me and as long as it works I'm happy. I don't know how to fix (or rather prevent) dreamweaver from putting in old/incorrect code. Since I'm on the topic of dreamweaver... I have just upgraded to Dreamweaver CS3 from version 8, and I've put in my webpages and now they are showing as if the images are left-aligned, but in fact are programmed as centre aligned. If I preview in browser it's ok, but in the actual program I can't seem to get the images to show centre or right aligned. This is really starting to agrevate me. Screenshot - http://www.stereofx.net/images/dw_screenshot.jpg webpage - http://www.stereofx.net/html/music.htm On a final note, what is the code I need in order to have a favicon on my site? Would I have to use the code on all my pages in order for it to show on all pages of the site? Thanks in advance. |
|
|
|
|
|
#4 (permalink) | |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,876
OS: Vista, various linux distros
|
Re: Forms > Required Fields
Okay, if you come up against any problems whilst writing the rest of the JS feel free to post for more help because i'm happy to give you a hand on this form.
Ouch, i didn't know dreamweaver was that bad at coding... If i get the time later today i'll take a look over your site and help you validate it. Quote:
Again with the images problem i believe the problem is how DW8 coded your site. I'll have a look later to give you a hand. As for the favicon, you can just place a file called "favicon.ico" in your server root in most cases but it's best to add these two meta tags to the HEAD of your page: HTML Code:
<link rel="icon" href="http://www.domain.com/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="http://www.domain.com/favicon.ico" type="image/x-icon"> Jamey |
|
|
|
|
|
|
#5 (permalink) |
|
Registered User
|
Re: Forms > Required Fields
Point taken, I do need to try make sure everything is perfect. Got the favicon up, thanks...
If you do get a chance to look at the site validation lets start with the home page http://stereofx.net 27 errors here :( |
|
|
|
![]() |
| Thread Tools | |
|
|