nbar
nbar

Reputation: 6158

Fluid Flux field for multible key:value

I search a flux field for multible key:value entrys that are editable in the backend. For a single line I use a normal input field:

<flux:field.input name="Title" label="Title" />

But now I would like to be able to add dynamicly values like:

Email [email protected]
Phone  ++12344556
OtherContat  value
OtherKey  otherValue

And then use this in a loop in fluid for the output.

What could I use for this?

Upvotes: 0

Views: 347

Answers (1)

Jost
Jost

Reputation: 5850

You can use the ViewHelpers flux:section and flux:object. It looks like this:

<flux:form.section name="contacts" label="Contacts">
    <flux:form.object name="contact" label="Contact">
        <flux:field.input name="email" label="Email"/>
        <flux:field.input name="phone" label="Phone"/>
    </flux:form.object>
</flux:form.section>

You can then render the data using something like this:

<ol>
    <f:for each="{contacts}" as="contactlistelement">
        <li>
            Phone: {contactlistelement.contact.phone}<br />
            Email: {contactlistelement.contact.email}
        </li>
    </f:for>
</ol>

There is a limit to this: Inside the flux:object, you cannot have a FAL field, like an image.

Upvotes: 1

Related Questions