Grow your CSS skills. Land your dream job.

Validation error & javascript

  • # November 27, 2009 at 11:36 am

    Hi,

    I’ve been playing around with the following code with a view to using it as a simple password protection for a web page. All works OK but when I put it through the W3C validator it throws up the following error -

    Quote:
    Line 41, Column 38: required attribute "action" not specified

    <form name="password1" id="password1">User name <input type="text" name="usernam

    The attribute given above is required for an element that you’ve used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.

    Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.

    The code is below:

    Code:
    < !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">








    ** LINE 41 —>>
    User name
    Password.


    Propbably my lack of experience and understanding so any help appreciated

    John C

    # November 27, 2009 at 9:52 pm

    Where does this form submit it’s information to? itself?

    <form name="password1" id="password1">

    needs to have an "action=…" attribute like this:

    <form name="password1" id="password1" action="">

    If you leave it blank (like above), it should submit to itself. (That’s most likely what happens when you don’t have an action specified.) You can tell it a page to submit to like this:

    <form name="password1" id="password1" action="/folder/page.php">

    Make sense?

    # November 29, 2009 at 9:34 am

    Ashton,

    Thanks for the reply – yes, makes sense and amended script works and has no validation error.

    John C

    # November 29, 2009 at 1:17 pm

    Great. You’re welcome!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".