Search

I have a client whose problem I’d like to solve with Symphony. I think that using the default back end for Symphony would be a bit tedious for them when entering their data. They’d have to jump all over the place to put things in different sections. What I’m wondering is if it’s possible to have multiple record inputs, like having an arbitrary number of addresses inputted and submitted with one page.

I think you’d need to make a section called phone numbers and select (multiple) them to a contact’s record. That would accomplish the arbitrary number of phone numbers bit. However, as far as reconfiguring the fields in a section (i.e., arbitrary field names and numbers of them), because of the database structure I doubt that you can do that on the fly.

Can you be a little more specific about what you’d like to be able to achieve? E.g. Are the addresses all going into one entry or into multiple entries?

I don’t think I explained that very well.

Say you have a form:

<form action="" method="post">
    <input name="fields[phone][0]"/>
    <input name="fields[phone][1]"/>
    <input name="fields[phone][2]"/>

    <input type="submit" name="action[save-phone]" value="Submit"/>
</form>

There would be a button that would add another input field that would look like fields[phone][3]. What I’m hoping is that there is some support in Symphony for comprehending that given name="fields[phone][n]" that n is an index in a set of phone fields and will make n + 1 entries in phone’s section.

You wouldn’t be able to dynamically add new fields to a single entry from the frontend. But if they’re separate entries, then yes, you might be able to pull it off.

Nope, not trying to add fields to a section this way. Just have multiple entries in a section.

Do you have any direction to give on how I might achieve multiple entries?

Not something I’ve done myself, but there’s an event filter that you can attach to your event called “Allow Multiple.” You might start there…

Craig’s spot on — select Allow Multiple and take another look at the HTML example shown for the event and you’ll be able to do just what you want.

And if you look at the example code, you will see that you will need to put the index before the field’s name, like so:

<input name="fields[0][phone]"/>
<input name="fields[1][phone]"/>
<input name="fields[2][phone]"/>

Okay so one last question: Can there be multiple actions executed with a single form submission?

You can edit the event that the action triggers to get that effect.

You mean the actual PHP file that is generated?

Craig’s spot on

Mark your calendars, boys. You may not see this again for a long long time ;)

Craig, you should get your wife to read this.

:-)

Showed it to her. She’s unimpressed.

Hmmm, still they have better sensors for candle-light mood and all this stuff…

(Will I win the the chauvinist award for this? It’s better than no award at all, isn’t it?)

Okay so one last question: Can there be multiple actions executed with a single form submission?

Yes. If you would like multiple events to trigger, add some hidden fields. Events created via the Symphony interface look for a trigger like action[EVENT_NAME], so a hidden field like the following would trigger it:

<input type="hidden" name="action[EVENT_NAME]" value="whatever"/>

You can add as many hidden fields as you wish. Just be aware that you cannot have one event dependant on the output of another unless you start customising.

@hoopy you asked:

You mean the actual PHP file that is generated?

@Alistair addresses this in post 18. If you can achieve the results you’re looking for with hidden form fields then there’s no PHP editing needed. Otherwise, you may need to edit the PHP event file that is created in /workspace/events/event.youreventname.php (e.g., in the case of dependent outputs etc).

The Symphony Crew is in the process currently of bringing the documentation up to speed for Symphony 2.x. In the meantime, I have found this old documentation post for Symphony Events to be helpful in getting me started.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details