Reply
best practice in forms
Old 03-16-2007, 10:49 PM best practice in forms
Skilled Talker

Posts: 70
Name: rex
i read alot of articles stating that if you're working with a form with a database backend...you use javascript to validate form entries. and once data are ready and valid you use php to save these data to the database.

1. is this the common practice of everybody?
2. correct me if im wrong. here it appears that javascript does all the dirty works. is the function of php simply to store data to the database?
shotokan99 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 03-17-2007, 12:32 AM Re: best practice in forms
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
I don't know where you read the articles you read, but that quite frankly is a pantload.

There's nothing wrong with using Javascript to validate a form if it's not your only method of validation. Like the Flash question you asked earlier, not everyone has Javascript enabled and in a browser such as Firefox, it's all too easy to disable.

You're better off to have a programming language, such as PHP, perform the validation with Javascript being used as a validator only for those who have it enabled (in other words, users with it enabled will have two levels of validation, Javascript and PHP...those that don't will still have PHP validation.)

Never leave the door open for anyone to do anything stupid like get past your form with no validation...not only will they do that, but they will see your entry point for stupidity and raise you ten idiotic things you and I would never have dreamed of. And that's a poker game that you don't want to play.
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 03-17-2007, 01:56 AM Re: best practice in forms
Skilled Talker

Posts: 70
Name: rex
ok adam i got ur point. which is better option and more efficient use flash forms or <form...> tag itself?
shotokan99 is offline
Reply With Quote
View Public Profile
 
Old 03-18-2007, 01:01 PM Re: best practice in forms
Tom_M's Avatar
Ultra Talker

Posts: 251
Name: Tom Maurer
Location: Pennslvania, USA
To add a little to this, if you are already using a server side language to put the data into a database, it would make more sense to use that same language to validate the info. Why have 2 languages doing something 1 could do.

Plus Adam hit the nail on the head about javascript. User can just disable js in their browsers. Something like php is handles at the server... making it more secure.
Tom_M is offline
Reply With Quote
View Public Profile
 
Old 03-18-2007, 01:34 PM Re: best practice in forms
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
The <form> tag. Not everyone has or wants to use Flash.
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Reply     « Reply to best practice in forms
 

Thread Tools

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

vB 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.12546 seconds with 12 queries