473,378 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

ajax form validation

pradeepjain
563 512MB
hii guys ,
I wanna share a very gud ajax validation script with php...
Ajax Form Validation - sForm | chains.ch weblog

I am very new to ajax .So i wanna small help....i want to improve that script with adding checkbox,radiobutton validation and dropdown list validation . but i am not able to do it.....any one can add his/her code into that ajax script..tht i can have a look at it..

And i have found a small bug in tht script ...say the submit button will be active by default which it shld not be..


thanks,
Pradeep
Nov 30 '08 #1
3 2077
Logician
210 100+
@pradeepjain
I cannot see the point of that code; it makes multiple server requests to perform a task that can be done client-side. It's certainly no substitute for conventional server-side validation, which is still essential. It looks like AJAX for the sake of it.
Nov 30 '08 #2
pradeepjain
563 512MB
@Logician
so wht do u think....ajax validation for client side is waste of resource is it....so we need to make a client side and server side validation is it...so whats the main use of ajax ..where must we use it..
Nov 30 '08 #3
Ajax is good for validating specific things that would be too much to send in the initial document. Like for a checkbox it would be best to use a server side to throw in a variable that you would use to ensure the form is filled out correctly.

Expand|Select|Wrap|Line Numbers
  1. form.onsubmit = function ()
  2. {
  3. return (window.getElementById ("tosagreed").checked == (true))
  4. }
Ajax would be good for (these are examples)...
  1. Checking that a username isn't already taken.
  2. Getting a long list of cities/provinces and sticking them into a drop down box when a user picks a specific country/state.
  3. Getting a list of online people on a page that is not meant to be refreshed (like a chat room).
  4. Saving stuff to the server you are actively editing (take a look at Google Documents, and Spreadsheets) so that you don't lose any information if your browser crashes.

Ajax isn't really the best choice for some of the things that sForm uses it for. Email validation, for example, can be done without using Ajax at all. With or without Ajax, though, you should always use server-side verification for everything no matter what. Because if it's client-side, they can get around it. The purpose of Ajax is to let users know that they are good to go before they submit, knowing they probably wont get a, "you filled the form out wrong!"
Nov 30 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

31
by: Tony | last post by:
I just noticed that prototype.js is one of the files in the Ajax.NET distribution - I'm pretty concerned about this. Does anyone know if this is the same "prototype.js" that is not well-liked...
1
by: AECL_DEV | last post by:
Hello Everyone, Ive seen alot of people saying that the best way to AJAX Validate a form is through the submit button, because validation should be synchronous. Im wondering, is there any good...
5
by: Martin | last post by:
Hello NG, I've been doing some AJAX for a few weeks now. The basics worked fine so far, but now I've got the following problem which I can't solve: With AJAX you typically update/replace only...
1
by: John Chan | last post by:
Hi, Im doing a maintenance application in ajax and coldfusion at work on IE6 exclusively. I have a save button on each form and i have to do various validations server side and on client side...
5
by: lucyh3h | last post by:
Hi, I am trying to use XMLHttpRequest to do server side validation. I have several fields on a form and a submit button. The submit button has an event assocated with it when clicked. The...
7
ak1dnar
by: ak1dnar | last post by:
Hi, I got this scripts from this URL There is Error when i submit the form. Line: 54 Error: 'document.getElementbyID(....)' is null or not an object What is this error. Complete Files
3
rizwan6feb
by: rizwan6feb | last post by:
Hi experts! Recently i was working on "Form Validation Using Ajax". My form validation was creating problem, when a user changes focus too quickly. I had a post related to this, but was unable to...
1
by: Mark B | last post by:
This is my first try at using AJAX. I want the calendars to be enabled if the user checks CheckBox1. It works OK for a normal all page refresh but once I introduced the AJAX code it stopped...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.