473,662 Members | 2,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.p hp" 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(postcod e
validation) and submits, or just solely use php validation?

Im open to ideas please.

Thanks

Oct 16 '06 #1
5 1934
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.p hp" 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(postcod e 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.p hp" 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(postcod e
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.p hp" 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(postcod e
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*******@attgl obal.net
=============== ===
Oct 17 '06 #6

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

Similar topics

11
3016
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 another page (ie. action="someotherpage.php"). You could validate the form data on the new page but it makes more sense to validate first before submitting, plus if there are errors, then you have to send the user back to the first page. There must be...
1
1714
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 though it contains invalid values. And sometimes it displays the warnings and submits the form! I'm really confused and don't know what else I can do (I want to provide the validation server-side)
2
3401
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 the user to enter an email address. It seems to be ignoring the validation rule and just emailing the form anyway, can anyone help? Below is the the relevant code -
10
3584
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 validate which radio button was clicked and what was in a textfield. The form is an attendance checking page for a cyber charter school. What I'm trying to accomplish is that if a parent marks the student present, there should not be anything in the...
4
4493
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 the input. On my development server, this form works precisely as expected. When I deploy the app to the production server (a hosting service), the client-side validation quits working altogether. Now, I KNOW that scripts are enabled and working...
5
1918
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 example if both UserID and Password text fields are required but neither is filled in, I'd like to display the error message (a dialogbox) "Please enter the User ID". And only after the user has filled in UserID, it will display "Please enter the...
1
1498
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 correctly validate. The validators in the control seem to validate but do not return true/IsValid as so my form is not submitted. I would like to do this ClientSide, the only resolution I can find is to perform the validation for the...
11
2986
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 certain fields match certain criteria, and inform the user in different ways when the data is wrong (offcourse, this will be checked on posting the data again, but that's something I've got a lot of experience with). Now, offcourse it's...
3
626
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 following structure (looping through for each menu item needing to be displayed): <tr>
0
8343
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8762
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7365
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4179
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.