Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Old 05-15-2005, 04:40 PM Form validation
Harvey's Avatar
Super Spam Talker

Posts: 901
Name: Harvey C
Location: Brighton, UK
Trades: 0
Hi

You know when you have a drop down menu, which, for example, might begin: "CountryŠUKŠUSAŠ...", does anybody know how I can make sure my users do not select the first one, "country"?

Thanks
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Harvey is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-15-2005, 09:33 PM
drewrockshard's Avatar
Super Talker

Posts: 100
Name: Drew
Location: Garland (Dallas), Texas
Trades: 0
technically, this should be in the javascript forum, but ill post it here anyway. what you have to do is give the form a name, lets call it "country". now keep the first entry "Select Country" like you have it. in a drop down box, javascript looks at all the values as an array, so you must treat it as that. so heres the javascript.
Code:
var myindex = document.forms[0].country.selectedIndex;
	if (myindex == 0) {
		alert("Please select a country from the appropriate menu.");
		document.forms[0].country.focus();
		return false;
	}
of course, you must call this when the form is submited. but i hope this helps you out a little.
__________________
Best Regards,
Drew Decker

Please login or register to view this content. Registration is FREE
drewrockshard is offline
Reply With Quote
View Public Profile
 
Old 05-16-2005, 04:12 AM
Harvey's Avatar
Super Spam Talker

Posts: 901
Name: Harvey C
Location: Brighton, UK
Trades: 0
Great, thanks, I'll take a look at that in more detail once I get home tonight
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Harvey is offline
Reply With Quote
View Public Profile
 
Old 05-16-2005, 08:32 AM
Junior Talker

Posts: 2
Trades: 0
Hey why do you need to include the country inside your drop down menu if you don't like other users to choose em?
alpha22 is offline
Reply With Quote
View Public Profile
 
Old 05-16-2005, 10:42 AM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
Good point...
Also, you should think about server side validation as well as client side (that is, if you're using any server side code to process it). Another good thing about ASP.NET - handles the client side and server side validation for you in the same control. Also protects against people dropping scripts into your forms.
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Reply     « Reply to Form validation
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.53650 seconds with 12 queries