[SalesForce] Can’t call a component inside a page

I would like to create a VF page and call a custom component inside it.


<apex:page controller="MyController">

<apex:form>

<c:mycomponent id="myId" attributeName="{attributevalue}"/>

</apexform>

<apex:page>

But this returns me: 'c:mycomponent' component cannot be nested within form tags'

I have tried to without the and call this page from another one using the tag, but it doesn't work either.

I read somewhere that is not possible to do what I need, but in the past I was allowed because I have some examples in my old code.

Is there a workaround now?

Thanks in advance

Best Answer

I think you need to check if c:mycomponent contains an apex:form tag and remove it.

Forms cannot be nested, and you can't cheat by wrapping it in a component ;-)

  • Possible workaround 1: mock out the apex:form with a plain vanilla form tag

  • Possible workaround 2: put component on a page in an apex:iframe to get the visual equivalent

Related Topic