Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (20.3k points)

Is it possible to nest HTML forms like this

<form name="mainForm">

  <form name="subForm">

  </form>

</form>

so that both forms work? My friend is having problems with this, a part of the subForm works, while another part of it does not.

1 Answer

0 votes
by (40.7k points)

The second form can be ignored, look at the snippet from WebKit for example :

bool HTMLParser::formCreateErrorCheck(Token* t, RefPtr<Node>& result)

{

    // Only create a new form if we're not already inside one.

    // This is consistent with other browsers' behavior.

    if (!m_currentFormElement) {

        m_currentFormElement = new HTMLFormElement(formTag, m_document);

        result = m_currentFormElement;

        pCloserCreateErrorCheck(t, result);

    }

    return false;

}

Related questions

0 votes
1 answer
asked Feb 25, 2021 in Web Technology by dev_sk2311 (45k points)
0 votes
1 answer
0 votes
1 answer

Browse Categories

...