awilkinson
awilkinson

Reputation: 1630

Orbeon - Can I parameterize a Section Template?

For example, I have a section template called "Full Name". It contains three fields:

  1. First Name
  2. Last Name
  3. Middle Initial

On some forms, I want to display Middle Initial and on others I want that field hidden. I've created a form that includes that section template as well as a section called "Variables" which is always hidden. That section includes a field called "Show Middle Initial".

The form instance data looks like this:

<form>
    <variables>
        <showMiddleInitial>true</showMiddleInitial>
    </variables>
    <fullName>
        <firstName/>
        <lastName/>
        <middleName/>
    </fullName>
</form>

I added a Visibility expression to the middleName control in the section template:

/form/variables/showMiddleInitial = 'true'

This is similar to this answer but in reverse since the section template is accessing the parent form's data. I thought this might work since they are all using the same instance data but unfortunately it doesn't. If the control is in a section template then the /form/variables/showMiddleInitial expression always returns empty. If it's in the same form as the showMiddleInitial field then it returns the correct value 'true'.

Am I doing something wrong? Or is there another way to accomplish this?

Upvotes: 0

Views: 57

Answers (1)

ebruchez
ebruchez

Reputation: 7857

The following expression should work:

xxf:component-context()/root()/form/variables/showMiddleInitial = 'true'

Upvotes: 1

Related Questions