nested forms

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jeff Thies

    nested forms

    Sometimes I may have one form nested inside the other (this is an editable
    page).

    <form name="form1">

    <form name="form2">
    </form>

    <input type="text" name="form_elem ent_for_form1">
    </form>

    What I'd like to do is read: form_element_fo r_form1, but the closing tag for
    form2 kills form1.

    How do I remove form2? It seems to be resistant!

    Jeff


  • Hywel Jenkins

    #2
    Re: nested forms

    In article <OTqQb.22092$q4 .11951@newsread 3.news.atl.eart hlink.net>,
    nospam@nospam.n et says...[color=blue]
    > Sometimes I may have one form nested inside the other (this is an editable
    > page).[/color]

    You *cannot* nest forms.

    --
    Hywel I do not eat quiche


    Comment

    • Jeff Thies

      #3
      Re: nested forms


      "Hywel Jenkins" <hyweljenkins@h otmail.com> wrote in message
      news:MPG.1a7c4e 271cca013798999 4@news.individu al.net...[color=blue]
      > In article <OTqQb.22092$q4 .11951@newsread 3.news.atl.eart hlink.net>,
      > nospam@nospam.n et says...[color=green]
      > > Sometimes I may have one form nested inside the other (this is an[/color][/color]
      editable[color=blue][color=green]
      > > page).[/color]
      >
      > You *cannot* nest forms.[/color]

      Yes, but can I remove the nested form with javascript?

      Jeff[color=blue]
      >
      > --
      > Hywel I do not eat quiche
      > http://hyweljenkins.co.uk/
      > http://hyweljenkins.co.uk/mfaq.php[/color]


      Comment

      • Martin Honnen

        #4
        Re: nested forms



        Jeff Thies wrote:
        [color=blue]
        > Sometimes I may have one form nested inside the other (this is an editable
        > page).
        >
        > <form name="form1">
        >
        > <form name="form2">
        > </form>
        >
        > <input type="text" name="form_elem ent_for_form1">
        > </form>
        >
        > What I'd like to do is read: form_element_fo r_form1, but the closing tag for
        > form2 kills form1.
        >
        > How do I remove form2? It seems to be resistant![/color]

        Look into the Mozilla DOM inspector on how that HTML is parsed, there
        will be only one <form> element in the DOM tree which has no element
        children and the <input> element doesn't have a form container:

        <html>
        <head>
        <title>nested forms?</title>
        <script type="text/javascript">
        function inspectForms () {
        var text = '';
        for (var i = 0; i < document.forms. length; i++) {
        var form = document.forms[i];
        text += 'form with index ' + i + ' has name ' + form.name +
        ' and parentNode ' + form.parentNode + ' with tagName ' +
        form.parentNode .tagName + '\n';
        }
        if (document.getEl ementsByName) {
        var input = document.getEle mentsByName('fo rm_element_for_ form1')[0];
        if (input) {
        text += 'input.form is ' + input.form + '\n';
        }
        }
        alert(text);
        }

        window.onload = function (evt) {
        inspectForms();
        };
        </script>
        </head>
        <body>
        <form name="form1">

        <form name="form2">
        </form>

        <input type="text" name="form_elem ent_for_form1">
        </form>
        </body>
        </html>

        --

        Martin Honnen


        Comment

        Working...