SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Thread: Form tags

  1. #1
    Simulation Cricketer
    Join Date
    Sep 2004
    Location
    australia
    Posts
    470
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Form tags

    Is it possible to have form tags within form tags? I tried it and it did not work, so if it is possible, is there another way you can do it?

    Thanks

  2. #2
    _ silver trophy ses5909's Avatar
    Join Date
    Jul 2003
    Location
    NoVa
    Posts
    5,466
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    What exactly are you trying to accomplish? If you tell us what you'd like to do exactly, we may be able to make a recommendation other than having a form tag within another.
    Sara

  3. #3
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.w3.org/TR/html4/interact/...html#edef-FORM
    <!ELEMENT FORM - - (%block;|SCRIPT)+ -(FORM) -- interactive form -->
    This means that the FORM element may contain one or more instances of block level elements, or SCRIPT elements, and must not contain any FORM element.

    I'm not entirely sure what you want to do though. You can have two forms, and then use CSS to position them, if it's the layout you wanted.
    Simon Pieters

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Interestingly enough, though:
    Code:
    <!ELEMENT FIELDSET - - (#PCDATA,LEGEND,(%flow;)*) -- form control group -->
    Which means that a FIELDSET inside a FORM may contain a nested FORM.

    As zcorpan said, you cannot have a FORM as an immediate child of a FORM, though.
    Birnam wood is come to Dunsinane

  5. #5
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think it's because it can't be expressed in a DTD... The XHTML 1.0 spec says:
    form
    must not contain other form elements.
    The same rule probably applies to HTML4 aswell, but I couldn't find anything about it in that spec.
    Edit:

    I don't want to bump this thread so I edit this post instead.

    -(FORM) in the DTD means that the element must not contain any FORM elements. It doesn't matter if it's a direct child or nested in a FIELDSET. So it can be expressed in a DTD, and it is.
    Last edited by zcorpan; Jun 18, 2005 at 09:58.
    Simon Pieters

  6. #6
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I agree with zcorpan. You can't express this in the DTD.

    Putting a form inside another form causes many problems in browsers anyway.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  7. #7
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Of course you can express it in the DTD: just use -(FORM) like for the FORM element itself.
    Birnam wood is come to Dunsinane

  8. #8
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You would have to put that on every element that can contain block level elements and then no element would be able to contain forms.

    You can't specify what elements can be the grand-children of any given elements.

    This is just one limitation of DTDs.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  9. #9
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I was talking about FIELDSET, but you're right, of course.
    Birnam wood is come to Dunsinane

  10. #10
    Simulation Cricketer
    Join Date
    Sep 2004
    Location
    australia
    Posts
    470
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Kravvitz
    I agree with zcorpan. You can't express this in the DTD.

    Putting a form inside another form causes many problems in browsers anyway.
    That is the deciding factor, I'll just go with a standard hyperlink. Thanks all


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
  •