Form problem, name versus id

Discussion in 'HTML' started by Fabian, Oct 16, 2003.

  1. Fabian

    Fabian Guest

    Hi,

    I want to install this nifty Google search-engine that searches within my
    site. But the problem is, it still uses name="q" instead of id="q". So I
    thought, I'll change name to id, but then the engine doesn't work anymore.

    Well there's no problem with using name="q" in HTML but there is in xHTML
    Strict. What can I do to prevent errors? Cause I really want this search
    engine and I want to keep my Strict doctype declaration ...

    This is the page: http://givelove.be/crap/buttons.html.

    And if I validate it, I get lots of other erros as well, it seems.
    Can anyone give me advise on how to use forms in xHTML and CSS?

    Thanks!
    --
    Fabian
    http://givelove.be/
     
    Fabian, Oct 16, 2003
    #1
    1. Advertising

  2. Fabian

    Fabian Guest

    In addition: the name tag can still be used. I was looking at the xHTML
    reference for the form-tag, not the input tag.

    However, I still have errors about input.

    Line 95, column 188: document type does not allow element "input" here;
    missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre",
    "address", "fieldset", "ins", "del" start-tag

    ...CC; color: #660000; height: 20px; " />

    I get this one on every input-tag. What's wrong with it?

    This is the code:

    <form method="get" action="http://www.google.com/custom">
    <input type="text" name="q" size="30" maxlength="255" value="" title="Vul
    uw zoekboodschap in" style="border: 1px solid #ff9900;
    background-color:#CCFFCC; color: #660000; height: 20px; " />
    <input type="submit" name="btng" value="Zoek" title="Zoek in deze site
    (givelove.be)" style="border: 1px solid #ff9900; background-color: #336666;
    color: #CCFFCC; height: 20px;" />
    <input type="hidden" name="domains" value="http://givelove.be" />
    <input type="hidden" name="sitesearch" value="http://givelove.be" />
    </form>


    Sorry for the first post ...
    --
    Fabian
     
    Fabian, Oct 16, 2003
    #2
    1. Advertising

  3. Fabian

    Fabian Guest

    Never mind anymore.

    I found the solution after some experimentations.
    This is it:

    <div id="googleform">
    <!-- sitesearch google -->
    <form method="get" action="http://www.google.com/custom">

    <div style="margin-left: 0px; position: absolute;"><input type="text"
    name="q" size="30" maxlength="255" value="" title="Vul uw zoekboodschap in"
    style="border: 1px solid #ff9900; background-color:#CCFFCC; color: #660000;
    height: 20px; " /></div>

    <div style="position: absolute; left: 10px; margin-left: 200px;"><input
    type="submit" name="btng" value="Zoek" title="Zoek in deze site
    (givelove.be)" style="border: 1px solid #ff9900; background-color: #336666;
    color: #CCFFCC; height: 20px;" /></div>

    <div><input type="hidden" name="domains" value="http://givelove.be"
    /></div>

    <div><input type="hidden" name="sitesearch" value="http://givelove.be"
    /></div>

    </form>
    <!-- sitesearch google -->
    </div>


    I'm sorry if you read this and wasted your time. I really am. Sorry.
    I hope it helps if someone encouters this problem too.

    --
    Fabian
    http://givelove.be/
     
    Fabian, Oct 16, 2003
    #3
  4. Fabian

    Dylan Parry Guest

    Sitting in an ivory tower, Fabian wrote:

    > Line 95, column 188: document type does not allow element "input" here;
    > missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre",
    > "address", "fieldset", "ins", "del" start-tag


    XHTML strict requires that forms are something like:

    <form method="post" action="foo">
    <div>
    <input type="text" />
    ...
    </div>
    </form>

    Notice the addition of the <div> element?

    --
    Dylan Parry
    http://www.webpageworkshop.co.uk - FREE Web tutorials and references
     
    Dylan Parry, Oct 16, 2003
    #4
  5. Fabian

    Kris Guest

    In article <>,
    Dylan Parry <> wrote:

    > > Line 95, column 188: document type does not allow element "input" here;
    > > missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre",
    > > "address", "fieldset", "ins", "del" start-tag

    >
    > XHTML strict requires that forms are something like:
    >
    > <form method="post" action="foo">
    > <div>
    > <input type="text" />
    > ...
    > </div>
    > </form>
    >
    > Notice the addition of the <div> element?


    The FIELDSET is for this purpose slightly more appropriate, IMO.

    --
    Kris
    erlands (nl)
     
    Kris, Oct 16, 2003
    #5
  6. Fabian

    Dylan Parry Guest

    Sitting in an ivory tower, Kris wrote:

    >> <form method="post" action="foo">
    >> <div>
    >> <input type="text" />
    >> ...
    >> </div>
    >> </form>
    >>
    >> Notice the addition of the <div> element?

    >
    > The FIELDSET is for this purpose slightly more appropriate, IMO.


    Only if the input elements are logically connected. I tend to put a
    division around the whole form contents just to be sure that I don't leave
    any inputs outside of a block level container.

    --
    Dylan Parry
    http://www.webpageworkshop.co.uk - FREE Web tutorials and references
     
    Dylan Parry, Oct 16, 2003
    #6
  7. Fabian

    Fabian Guest

    >> Notice the addition of the <div> element?
    >
    > The FIELDSET is for this purpose slightly more appropriate, IMO.


    And how should I use it? The same way as div? Or should I just put it around
    the form tags?


    --
    Fabian
    http://givelove.be/
     
    Fabian, Oct 16, 2003
    #7
  8. Fabian

    Steve Pugh Guest

    "Fabian" <> wrote:

    >I want to install this nifty Google search-engine that searches within my
    >site. But the problem is, it still uses name="q" instead of id="q". So I
    >thought, I'll change name to id, but then the engine doesn't work anymore.


    name is the proper thing to use to identify form inputs.

    Use id to attach styles, associate labels, play silly DOM games, etc.
    but use names to give the name part of the name=value pair that gets
    submitted.

    Think about radio buttons. They must all have the same name in order
    to work, so how on earth could your replace it with id which would
    have to be unique for each element?

    >Well there's no problem with using name="q" in HTML but there is in xHTML
    >Strict.


    name is still in XHTML 1.0 Strict for <input>.

    See http://www.w3.org/TR/xhtml1/#h-4.10 and note that input is not on
    the list of elements for which name is deprecated.

    >This is the page: http://givelove.be/crap/buttons.html.
    >
    >And if I validate it, I get lots of other erros as well, it seems.
    >Can anyone give me advise on how to use forms in xHTML and CSS?


    That page validates. have you fixed the problems?

    Steve

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
     
    Steve Pugh, Oct 16, 2003
    #8
  9. Fabian

    Fabian Guest

    Steve Pugh wrote:
    > That page validates. have you fixed the problems?
    >
    > Steve


    Yes, I have. Everything's fixed now. You can read that in my other replies.

    Another question though, if I apply a style on a textbox and on a button
    than Opera shows them right but Explorer doesn't. Is that correct?
    So if I choose the same width and height and font-size (etc...) for the
    texbox and the button, Explorer interprets them differently I think. Cause
    the button is smaller than the textbox. I don't get it. I've been trying
    this for a while now too. I really don't understand it. Opera shows
    everything as I want it. But Explorer doesn't.

    What should I do, go for Opera (my default browser) or modify it so it looks
    as I want it in Explorer (6.0)?


    --
    Fabian
    http://givelove.be/
     
    Fabian, Oct 16, 2003
    #9
  10. Fabian

    Kris Guest

    In article <1Pyjb.81474$-ops.be>,
    "Fabian" <> wrote:

    > > The FIELDSET is for this purpose slightly more appropriate, IMO.

    >
    > And how should I use it? The same way as div? Or should I just put it around
    > the form tags?


    Use it to group form subelements. The purpose gets clearer when
    pondering how to associate something to a set of form subelements that
    have already their own labels.

    <form>
    <fieldset>
    <legend>What did you have for dinner yesterday?</legend>

    <label><input ..> Pasta</label>
    <label><input ..> Fastfood</label>
    <label><input ..> Healthy stuff</label>
    <label><input ..> An old friend</label>

    </fieldset>
    </form>

    --
    Kris
    erlands (nl)
     
    Kris, Oct 16, 2003
    #10
  11. Fabian

    Fabian Guest

    Kris wrote:
    > <form>
    > <fieldset>
    > <legend>What did you have for dinner yesterday?</legend>
    >
    > <label><input ..> Pasta</label>
    > <label><input ..> Fastfood</label>
    > <label><input ..> Healthy stuff</label>
    > <label><input ..> An old friend</label>
    >
    > </fieldset>
    > </form>


    So I've used Fieldset but in Opera I get a border around my little form and
    I can't get it away by using style="border: none;"

    http://givelove.be/index.php <- at the right-hand side, under the
    navigation

    --
    Fabian
    http://givelove.be/
     
    Fabian, Oct 16, 2003
    #11
  12. Fabian

    Kris Guest

    In article <8Szjb.81618$-ops.be>,
    "Fabian" <> wrote:

    > So I've used Fieldset but in Opera I get a border around my little form and
    > I can't get it away by using style="border: none;"
    >
    > http://givelove.be/index.php <- at the right-hand side, under the
    > navigation


    I usually use border: 0; or border-width: 0; (long version) and i
    experience no problems with borders then in Opera.

    --
    Kris
    erlands (nl)
    "We called him Tortoise because he taught us" said the Mock Turtle.
     
    Kris, Oct 16, 2003
    #12
  13. Fabian

    Fabian Guest

    Kris wrote:
    > In article <8Szjb.81618$-ops.be>,
    > "Fabian" <> wrote:
    >
    >> So I've used Fieldset but in Opera I get a border around my little
    >> form and I can't get it away by using style="border: none;"
    >>
    >> http://givelove.be/index.php <- at the right-hand side, under the
    >> navigation

    >
    > I usually use border: 0; or border-width: 0; (long version) and i
    > experience no problems with borders then in Opera.


    I've tried your suggestion but still ... Nothing changes.

    Code:
    <fieldset style="border: 0; margin: 0px; padding: 0px;">

    --
    Fabian
    http://givelove.be/
     
    Fabian, Oct 16, 2003
    #13
  14. Fabian

    Kris Guest

    In article <b3Ajb.81645$-ops.be>,
    "Fabian" <> wrote:

    > > I usually use border: 0; or border-width: 0; (long version) and i
    > > experience no problems with borders then in Opera.

    >
    > I've tried your suggestion but still ... Nothing changes.


    Any here? I didn't see any.
    <http://www.joukedevries.nl/contact/>

    --
    Kris
    erlands (nl)
    "We called him Tortoise because he taught us" said the Mock Turtle.
     
    Kris, Oct 16, 2003
    #14
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. rocky
    Replies:
    2
    Views:
    328
    rocky
    Jul 7, 2009
  2. John Davis
    Replies:
    2
    Views:
    406
    Dave Anderson
    Aug 18, 2003
  3. Paul Butcher
    Replies:
    12
    Views:
    752
    Gary Wright
    Nov 28, 2007
  4. Pavils Jurjans
    Replies:
    3
    Views:
    207
    Pavils Jurjans
    Mar 18, 2005
  5. Replies:
    6
    Views:
    189
Loading...

Share This Page