SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Required Fields

  1. #1
    SitePoint Enthusiast sajx's Avatar
    Join Date
    Jul 2008
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Required Fields

    Hi..

    I am building a form, and I want to make some of the fields mandatory/required... can this be done simply with xhtml or do i need to use something else?
    aj

    The journey of a thousand miles begins with a single step...

  2. #2
    SitePoint Addict joaquin_win's Avatar
    Join Date
    Jul 2005
    Location
    Venezuela
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Uhm, xhtml is for data markup. Validation is behavior, you have to use either Javascript (for client side validation) or, better, a server side technology (PHP, etc) to validate data.

    If you don't understand much of what I said, you're on the start of a very interesting path (web development is quite fun, hehe). Read some books

  3. #3
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi AJ,

    You're going to have to use a server-side programming language (such as PHP) to handle the validation and "required" parts of the form. Of course, you'll have to use HTML to "mark up" the required elements so the user can know which parts of the form have to be filled out (or else), but the script that processes the form would handle the actual work to see if the required fields were filled out.

    You can use JavaScript to "pre-validate" the form, but it will only help as an assistant rather than actually handle the validation itself. If you'd like to see a good example, check this out (made by a friend of mine for someone else). http://www.cutcodedown.com/for_other...on/contact.php

    The directory is unlocked, and the PHP source files are available by clicking on the .phps files (you can view them directly in your browser). Also note that the fieldset containing the submit button should be removed - a DIV is better used there.

  4. #4
    SitePoint Enthusiast sajx's Avatar
    Join Date
    Jul 2008
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey everyone.. thanks for the info..

    joaquin_win i have a lot of catching up to do.. but it's going well so far

    again .. thanks
    aj

    The journey of a thousand miles begins with a single step...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •