SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Evangelist dhtmlhelp's Avatar
    Join Date
    May 2003
    Posts
    575
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XHTML 1.0 Strict Validation problems

    Hi,

    an obscure result from the W3C validator:

    Line 286, column 14: there is no attribute "name" (explain...).
    <form name='calculator' method='post' action='cart.php'>

    Can anyone explain?

    thanks,

    DH

    Edit: I am using javascript, and I need to give the form a name, is there an alternative that validates?
    Last edited by dhtmlhelp; Nov 12, 2003 at 16:23.

  2. #2
    SitePoint Addict BenANFA's Avatar
    Join Date
    Apr 2003
    Location
    Bath, UK
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For the script thing, the format has changed

    old
    Code:
    <script language='Javascript'>
    new
    Code:
    <script type='text/javascript'>
    The target attribute of the <a ... > tag is depricated with no replacement, general consensus nowa days is that it is up to the user to decide if they want to open a new window not the web designer.

    The body atribute is onload not onLoad.

    From the DTD name does not appear to be a form attribute.

  3. #3
    SitePoint Evangelist dhtmlhelp's Avatar
    Join Date
    May 2003
    Posts
    575
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ben thanks,

    just resolved what you recommended. Shame about the name thing, hope someone has a solution for that.

    thanks

    DH

    Edit: For the name tag, does it mean I should be modifying the javascript?

  4. #4
    SitePoint Zealot
    Join Date
    Nov 2003
    Location
    Houghton, Michigan
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try id. I think that is how you are supposed to do that. Im not sure though, I havent done javascript.

  5. #5
    SitePoint Evangelist dhtmlhelp's Avatar
    Join Date
    May 2003
    Posts
    575
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No id doesn't do it, thanks for the suggestion though.

    DH

  6. #6
    SitePoint Addict BenANFA's Avatar
    Join Date
    Apr 2003
    Location
    Bath, UK
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You will probably have to modify your Javascript then, you can still access the form though the forms array of the document object.

  7. #7
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Solutions to the "name" issue:
    • Drop to XHTML Transitional and use name and ID. Transitional is not as bad as you think .
    • Change your script to use the form index, like document.forms[0] instead of calling by name.
    • Change your script to do something like document.getElementById("form1").elements; or document.getElementsByTagName("FORM").item(0) instead of document.forms[formname]. You can then use the form ID rather than a name.

    Hope this helps!

  8. #8
    SitePoint Evangelist dhtmlhelp's Avatar
    Join Date
    May 2003
    Posts
    575
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It Vorks!!

    thanks vinnie.

    DH

    BTW: I have used your third solution. Better to be strict than sorry

  9. #9
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Glad to help!

  10. #10
    SitePoint Zealot lord's Avatar
    Join Date
    Nov 2003
    Location
    sLOVEnia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by vgarcia
    Solutions to the "name" issue:
    • Drop to XHTML Transitional and use name and ID. Transitional is not as bad as you think .
    • Change your script to use the form index, like document.forms[0] instead of calling by name.
    • Change your script to do something like document.getElementById("form1").elements; or document.getElementsByTagName("FORM").item(0) instead of document.forms[formname]. You can then use the form ID rather than a name.

    Hope this helps!
    hello

    I'm transforming my html 4.01 to xhtml 1.0 strict
    Well in strict mode, there is no name atribute, so I must change it to id.
    I also must change my JS where I use name atribute. I try yours advice but somehow I didn't manage to work it out properly.
    Coukd you please have a look and do some proper changes on PA atribute.

    thanx in advance


    <code>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />

    <title>Pregled virmanov</title>
    <style type="text/css" media="all">@import "<!$MG_POT_CSS>style.css";</style>

    <script type="text/javascript" src="<!$MG_JAVA_PATH>date-picker.js"></script>
    <script type="text/javascript">
    <!--
    function setformfocus() {document.getElementById("VNOS").PA.focus();}
    function submitonce(){document.forms[0].B1.disabled=true}
    //-->
    </script>

    </head>

    <body onload="setformfocus()">

    <p id="naslov">Virmani</p>

    <form action="<!$MG_REQ>" method="post" target="_self" id="VNOS" onsubmit="submitonce(true)">
    <input type="hidden" name="APPNAME" value="<!$MG_APPNAME>" />
    <input type="hidden" name="PRGNAME" value="FI_PRVI_02_B_K" />
    <input type="hidden" name="ARGUMENTS" value="PA,DO,D1,D2,S1,IZ,S2,SLIKA" />
    <input type="hidden" name="SLIKA" value="1" />

    <table width="100%" class='table' cellspacing="0" cellpadding="0">
    <tr class="trm1_b">
    <td width="50%" class="tdm_r"><a href="javascript:PA(document.VNOS.PA.value)">Partner/a></td>
    <td width="50%" class="tdm_l"><input type="text" class="inbox" name="PA" size="8" maxlength="8" /></td>
    </tr>
    </table>
    </form>

    <script type="text/javascript">
    <!--
    function PA(vred)
    {
    document.VNOS.PA.focus();
    var url = "<!$MG_REQ>?AppName=<!$MG_APPNAME>&PrgName=SI_PART_01_B_K&arguments=-APA,-A"+vred+",-AVNOS";
    var hWnd = window.open(url,"HelpWindow","width=450,height=500,resizable=yes,scrollbars=yes");
    if (!hWnd.opener) hWnd.opener = self;
    if (hWnd.focus != null) hWnd.focus();
    }
    // -->
    </script>

    </body>
    </html>
    </code>

  11. #11
    SitePoint Zealot lord's Avatar
    Join Date
    Nov 2003
    Location
    sLOVEnia
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    now it works


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
  •