function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NickforceNickforce 

Nested form tag error using include component

What would be the best practice solution for when my markup's basic structure looks like the following:

 

<apex:page>
  <apex:form>
    <apex:tabpanel>
      <apex:tab>
        <apex:include pageName="page1" />
      </apex:tab>
      <apex:tab>
        <apex:include pageName="page2" />
      </apex:tab>
    </apex:tabpanel>
  </apex:form>
</apex:page>

 With this structure, if I put a form tag in either 'page1' or 'page2' then I will receive the nested form error message.



willardwillard

You can't nest form tags from what I recall.  If you want two different forms, just get rid of the parent form tag.  

Shashikant SharmaShashikant Sharma

That is what your structure should be 

<apex:page>
   <apex:tabpanel>
      <apex:tab>
        <apex:include pageName="{!$Page.Page1}" />
      </apex:tab>
      <apex:tab>
        <apex:include pageName="{!$Page.Page2}" />
      </apex:tab>
    </apex:tabpanel>
</apex:page>

 I would like to know why you want to use apex:form in this page, if there is any specific reason please share so that we can think of any other way to achieve it. if your query was just to find a proper structure then above is your answer.

 

Salesforce Exapmle in Documentation is also like the same

<apex:page id="thePage">                                                                      <apex:tabPanel switchType="client" selectedTab="name2" id="theTabPanel">                         <apex:tab label="One" name="name1" id="tabOne">content for tab one</apex:tab>                                               <apex:tab label="Two" name="name2" id="tabTwo">content for tab two</apex:tab>                </apex:tabPanel>                                                                               </apex:page>

 

NickforceNickforce

I was trying to use a actionFunction component is the reason for the form tag