Jump to content

Webdevelopment


vijay587

Recommended Posts

  • 6 months later...

For those with JavaScript available - I would think that you could do some simple verification using JavaScript before submitting the form. And then do a more thorough validation using php and Regular Expressions. I'm also far from an expert, but I've read that somewhere and it would make for a better user experience for most.

Edited by markvs
Link to comment
Share on other sites

That doesn't make sense to me - if PHP takes care of everything for everybody, why also muddle with a partial solution that only works for some? Not sure what kind of a user experience you are thinking of providing - we're talking form validation.

Link to comment
Share on other sites

Before you send the form to the server to be processed by the php interpreter, it would be nice if all of the required fields had some data; preferably in the correct format. eg. An email address could be checked to make sure it had some minimal formatting, such as making sure it contained the "@" and "." symbols and this could be done by JavaScript on the clients computer. If a required field was left blank, that could be checked, etc. - all before you send a request to the server. Considering that a very large percentage of users have JavaScript turned on (over 97%, I think), it would be a good idea to use JavaScript and php to process a form. JavaScript to improve the user experience and take some of the load off of the server, and php to take care of the real processing which is much more secure than JavaScript. Like I said, I'm far from a pro, but this is what I've read.

Link to comment
Share on other sites

Hi,

Mostly we use JavaScript for Client side validation,why because the network round trips between client and server is very mush reduced by using js,

on the other hand PHP is used for communicating with the databases like MYsql,etc and retriving the data also.

 

HTML+CSS -----> Designing purpose

javascript ------>Validating and dynamic action purpose

PHP/SOAP ------->Communicating with databases , for public and custom webservices.

Mysql--------------->open source DB.

 

Thank you.

 

Regards

sudheer..:mellow:

Link to comment
Share on other sites

I would say PHP as well.

 

Here at work we use Java and/or Classic ASP. In the Classic ASP apps I have been updating or maintaining we do use JS, but only as a mask, ensuring that the data fits the format requirements. So you can use JS to format a telephone number as you wish on the fly. Most folks (US) tend to write (555) 555-1234, but not all, so a JS mask can take any numbers and format it as the database needs it. Masking not only makes it easier for the user, but it can format the data or require data (not allow you to finish without an area code for instance.)

 

The simple answer from me is PHP to flat out answer the question.

 

That said, using the JS mask allows you to format the data as reqyuired for the database so all the PHP needs to do is validate rather than...

 

IF telNr. is (XXX)XXX-XXXX add a space between ) & X

 

IF telNr. is XXX XXX-XXXX add () around the first 3 didgits.

 

etc. etc. etc.

 

JS frees the PHP to do pure validation. So best is PHP and maybe do formatting requirements etc. with JS additionally.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...