473,385 Members | 1,912 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,385 software developers and data experts.

Validation after form submitting..

Basically, im redesigning a form page on our website.

Currently the user submits the form, it does a few javascript checks
and either submits to the "processstuff.php" page, or gives the user a
JS error message.. where they have to go back and fill the details in.

Im trying to optimise and make this form/page as best as it can be.

Do you think it would be a better idea to continue using JS or use JS
then submit to the php page(where it checks some other details(postcode
validation) and submits, or just solely use php validation?

Im open to ideas please.

Thanks

Oct 16 '06 #1
5 1917
Rik
Advo wrote:
Basically, im redesigning a form page on our website.

Currently the user submits the form, it does a few javascript checks
and either submits to the "processstuff.php" page, or gives the user a
JS error message.. where they have to go back and fill the details in.

Im trying to optimise and make this form/page as best as it can be.

Do you think it would be a better idea to continue using JS or use JS
then submit to the php page(where it checks some other
details(postcode validation) and submits, or just solely use php
validation?
The best is always to do both:
1. JS validation will inform the user instantly that something is not OK,
and it will save him a trip to the server and back: better for the user,
less load on the server: a win-win.
2. JS validation can easily be bypassed or JS can be disabled by the user,
so always, always, check again with PHP on the server itself.

Grtz,
--
Rik Wasmus
Oct 16 '06 #2
>Basically, im redesigning a form page on our website.
>
Currently the user submits the form, it does a few javascript checks
and either submits to the "processstuff.php" page, or gives the user a
JS error message.. where they have to go back and fill the details in.
Remember, spammers, bots, viruses, and other nasties tend not to
use Javascript. And anyone can turn it off.
>Im trying to optimise and make this form/page as best as it can be.

Do you think it would be a better idea to continue using JS or use JS
then submit to the php page(where it checks some other details(postcode
validation) and submits, or just solely use php validation?
You *MUST* use php validation for security. Javascript is useful
for excluding users who refuse to turn it on or don't know how to
turn it on, and it can make the page a bit friendlier.
Oct 16 '06 #3
You can use AJAX with PHP, by AJAX make the php validation without
refreshing the page, after submitting do the validation again for
security. This is more friendly for users, and you can use php power
all the time.. (JS have a lot of bugs, use PHP cause of that)..
You can find a 5 minute tutorial at :
http://www.nurazije.co.nr/2006/10/5-...-tutorial.html

Oct 17 '06 #4

Gordon Burditt wrote:
Basically, im redesigning a form page on our website.

Currently the user submits the form, it does a few javascript checks
and either submits to the "processstuff.php" page, or gives the user a
JS error message.. where they have to go back and fill the details in.

Remember, spammers, bots, viruses, and other nasties tend not to
use Javascript. And anyone can turn it off.
Im trying to optimise and make this form/page as best as it can be.

Do you think it would be a better idea to continue using JS or use JS
then submit to the php page(where it checks some other details(postcode
validation) and submits, or just solely use php validation?

You *MUST* use php validation for security. Javascript is useful
for excluding users who refuse to turn it on or don't know how to
turn it on, and it can make the page a bit friendlier.
Yea i get what you mean and see why its needed really.

This is how im thinking it should go in my head:

user submits form JS checks If valid next page, if not valid go
back(msgbox), THEN send form variables to php processing page (store as
session) Perform php validation if false, return to the page and
put the session variables in the form fields so they dont need to fill
it in all again?

That about right?

Oct 17 '06 #5
NurAzije wrote:
You can use AJAX with PHP, by AJAX make the php validation without
refreshing the page, after submitting do the validation again for
security. This is more friendly for users, and you can use php power
all the time.. (JS have a lot of bugs, use PHP cause of that)..
You can find a 5 minute tutorial at :
http://www.nurazije.co.nr/2006/10/5-...-tutorial.html
And AJAX fails to call PHP validation if the user has JS disabled -
which is a big reason for having PHP validation in the first place!

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 17 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: peebrain | last post by:
I understand how to validate form data when a form is submitted to 'self' (ie. action="$_SERVER_"). In this case you simply validate before processing. However, what if submitting the form to...
1
by: Suzanne Murray | last post by:
Hi, I am trying to provide some simple validation using Javascript on my form. However at times the validation works and at others it doesn't and submits the form without any warnings even...
2
by: Andrew | last post by:
I've ripped off some script from another site of mine that works fine which checks an input box to see if an email address has been entered when submitting. If it hasn't a prompt is issued asking...
10
by: Steve Benson | last post by:
Our regular programmer moved on. I'm almost clueless in Javascript/ASP and got the job of adapting existing code. In the page below, everything works until I added the function checkIt() to...
4
by: earwicker | last post by:
I recently deployed a web application which contains a user registration form with the usual fields: name, address, email, password, etc. Each of the TextBoxes uses a validation control to verify...
5
by: Sun Jian | last post by:
Hi, I am trying to customize the asp.net validation to achieve the following: Upon submitting the form, client side validation will run, and it will stop at the first error detected. For...
1
by: MattC | last post by:
I have a user control that contains several requiredFieldValidators. The page the control sits in has other RequiredFieldValidators. On submitting the form all the validators on the page fire and...
11
by: Rik | last post by:
Hello guys, now that I'm that I'm working on my first major 'open' forms (with uncontrolled users I mean, not a secure backend-interface), I'd like to add a lot of possibilities to check wether...
3
by: George Thompson | last post by:
Hi, I come from an ASP background, and I am currently working on a .NET project, so please excuse me if this is a dumb question ... I have written a dynamically generated menu that uses the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.