Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Junior Member merrontech's Avatar
    Join Date
    Feb 2019
    Location
    Middle Earth
    Posts
    8
    Member #
    60414
    Liked
    2 times

    Lightbulb Easy to implement JS form validation template?

    Hello I'm trying to provide a nice form validation for the users on a contact form (not back end / PHP). For example when a user misses a required field or enters an invalid email address I want that field to be highlighted with a helpful message.

    It seems like Javascript is the way to go, but I'd prefer to use a premade template if a good one exists, is there a good solution which is easy to implement? (I don't normally do any JS so am hoping to import a JS file and change a few settings)

    I've seen tutorials on YouTube but not quite what I'm after, I need something that puts the website user first. The browser's standard validation doesn't seem to be enough.

    Thank you in advance for any response!

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,679
    Member #
    5580
    Liked
    714 times
    Google that ... I find hundred and hundreds of examples.

    Most of us who actually do scripting use AJAX, a combination of javascripting and server-side. AJAX, the server-side portion can be PHP or Perl or whatever. And there is a reason for that ... you should not allow the user to control the variables coming in. Everything needs to be validated and sanitized server-side. Javascripting is client-side, where the users can alter variables, content, cookies, and anything else that happens in the browser.


  4. #3
    Junior Member merrontech's Avatar
    Join Date
    Feb 2019
    Location
    Middle Earth
    Posts
    8
    Member #
    60414
    Liked
    2 times
    Hi mleim, thank you very much for your reply. I have Googled around but I tried a few which weren't quite what I'm after or just didn't work, I'm hoping instead to get recommendations based on people's opinions and experiences.

    I know that validation must also be done client side and have scripted the PHP validation already, what I'm looking for is increasing ease of use on the contact form by providing validation at the front end - presumably with Javascript. I hope that clarifies my post? I work on the aesthetics and ease of use separately from when I do the PHP so it's much better for me if the front end validation is not reliant on PHP. It's only there to help the user.

    Many thanks

  5. #4
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,679
    Member #
    5580
    Liked
    714 times
    You did a Google search like this? jquery form with validation examples

    There are so many examples, using JQuery, Bootstrap, plain javascripting, etc.
    How can you say that none of them were of any use?

    I always use AJAX, and I do the validation both client side and server side. As the user fills out the form, information is going directly into a database (assuming they are registered and logged in). If they leave the site or things crash, information is put into the database whether they click "submit" or not. If the users are "cold users" or anonymous, there would be no database for them unless you can identify them. In that case, the data they enter has to go somewhere (email, temporarily stored?).


    Again, the same answer as other posts you've made ... we have no idea what your client's customers will be uploading, or what the forms are used for. It doesn't have to even be a website form. You can have people text photos and content to your client ... they don't even use a browser in that case.



Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:03 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com