Hi. Could someone explain why I must use javascript while creating websites?. For example, let's take form validation. I write a javascript to validate form, but the script can be turned off by user, so i have to write that form validation in php file anyway. So what is the point of javascript if you always have to the same with php because user can turn off javascript?
4 replies to this topic
#1
Posted 21 July 2011 - 12:44 AM
|
|
|
#2
Posted 21 July 2011 - 02:10 AM
With the javascript validation you can tell the user if the fields are correctly filled in while the user is still typing. This allows the user to correct all the error before having to click submit. You can of course do everything in PHP only without any actual loss in validation ability. Javascript is all about making the website neat, like it usually is.
#3
Posted 21 July 2011 - 04:37 AM
You don't have to use JavaScript at all, but it allows you to do a lot more. AJAX calls for auto-complete (on Google) are just one example. Form validation is another. Also, most people have JavaScript enabled, since there are a number of sites that simply don't function properly without it.
#4
Posted 21 July 2011 - 08:48 AM
To elaborate one aspect, java script provides client side scripting which means to perform some programtic behavior INSIDE THE CLIENT BROWSER, it does not have to get/post back to the server, generate the response and give it back.
Today is the first day of the rest of my life
#5
Posted 21 July 2011 - 01:41 PM
As far as form validation goes: Server side valiation is top priority.
You add Javascript validation only for more user friendlyness because it's quicker and does not require a page refresh.
You add Javascript validation only for more user friendlyness because it's quicker and does not require a page refresh.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









