Why do other FORM tags always post to the parent XPage?

I’ve been reading many of the XPage wiki articles and don’t understand what is probably a basic concept.

I have a very basic XPage with a custom control at the top. It’s the common navigation header for the web site. This is raw HTML. It has a FORM tag that is set to POST a search-text box to our google search appliance.

The FORM tag is proper XHTML. Nothing wrong with it. Why does this FORM send the POST back to the XPage, instead of what is written?

Subject: Nested form tags tend to confuse the browser

Just like in traditional Domino, the HTTP task wraps all of the rendered content in a form tag, so that the page has something to post back to. Unlike traditional Domino, however, there’s no way to close the form tag it generates, start your own, and then let Domino close yours. As a result, defining your own form as passthru results in a nested form element, which tends to confuse the browser, causing it to post to the outer form instead of the action specified for the inner form. If you set the createForm attribute for the top-level XPage element to false, that suppresses the generation of the default form tag, which will allow your inner form to work properly… but will break any events; by suppressing the default form, the XPage no longer has anything to post back to, so events like pager navigation, etc., no longer function correctly.

On the other hand, if the URL structure of the target page is predictable, you can skip the inner form approach entirely. For example, if you were just forwarding the user to standard Google search results, you could place the following in an event handler for the search button:

facesContext.getExternalContext().redirect(“Google” + getComponent(“searchField”).getValue());

The user will be redirected to the correct page based on what they entered in the search field, which is typically the intent of having the separate form tag, but with this approach, the separate form tag is unnecessary.

Hope that helps…