Forum

Thread tagged as: Events

Events Description

Is there any way to set event description in the event.html template as not required? I have tried setting it to false but no joy.

Neil Irwin

Neil Irwin 1 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

There's not currently. It's always required.

No worries thanks.

Be good if it could be set to not be required or removed completely. The scenario I am using the events app in is for a list of fixtures and the vast majority don't require further information to be displayed however the odd one may require it so I have to add another area for this and wrap it in perch if tags as a work around. Would have been easier to do that using perch if tags round the description field.

I could currently do with a way to remove the event description or make it not required. Is there an option to do this, even if I need to modify the app code slightly?

Or is there some way to change the field type to "hidden" and always give it a value in the template? (I tried to add type="hidden" but that didn't work). Or perhaps some way to populate it with JS after the editor screen loads, and then hide it with JS or CSS? Is there a hook to add custom JS to the CP? I sometimes do this in Expression Engine, though I appreciate that it would be a powerful tool and could create problems.

I've just spend some time struggling to get rid of the Events description field for a band site gigs listings page. I tried changing the label to Venue Town, but that change was ignored, as was type='text' and rows='1'.

It looks like our users will have to type something into the field, which I have excluded from the output template in the Listings folder.

Could this be looked at in the next Events app update, please?

I did a quick one line hack to the Events app which made the description field a hidden field with the value of "n/a". I don't have it to hand, but it did the trick for me.

If you can get your hands on the hack, I'd like to add it in to our Events app. I realise it would need to be added every time Events is updated, but I think it's worth the effort.

Here's the change I made (posted here without warranty or support). It's a quick and dirty hack and as you say it will be overwritten by future updates to the Perch Events app.

In perch/addons/apps/perch_events/modes/edit.post.php

Around line 34 (which renders the Description field) I now have:

        // MOD Replace the description with a hidden field (so validation is happy but user needn't see it)
        // echo $Form->textarea_field('eventDescRaw', 'Description', isset($details['eventDescRaw'])?$details['eventDescRaw']:false, '', $Template->find_tag('eventDescHTML'));
        echo '<input type="hidden" name="eventDescRaw" value="n/a" >';
        // END MOD

This doesn't render the text area, but instead puts in a hidden field with the same name, and a value of "n/a" which we never show on the site anywhere, but it means validation is happy that there's something in the field.

There may well be better ways to achieve this, but this was quick and worked for us.

Thank you very much. I was looking at this area myself, but got bogged down studying the textarea_field parameters.

Excellent thank you Paul Bell

Does this hide every description? I'm looking for a way to use <perch:if> as my client requires the ability to add a description at times but not always.

Yes, this basically removes the Event Description field from the admin interface. What you could do is use the hack above, and then create another custom field (which would be optional and so allowed to be left blank) which the client could then use as the description.

Oh of course!! That seems obvious now you've said it. Thank you Paul, I'll give this a go!

Bumping an old topic. Would there be a similar hack to remove the event title, and then when submitted replace it with a value from the template? for example, the eventTitle becomes homeTeam v awayTeam for a sports fixture?

Hi Locky

In the case of a fixture list you would probably be better creating your own custom content template for this. Adding a drop down for the user to select if it is a home or away fixture. This is a method i used on https://dungannonrugby.com/match/ . I have also added a check for a heading and provided a click through to read more if one is present. For match reports etc.

This will allow you to choose what fields you want to set as required.

Nice work on the Dungannon Rugby club site Neil. I recently tried to use the events app for a simple events listing (art exhibitions) and quickly hit some serious limitations, so ended up reverting to using the blog app which seemed to be much more customisable. Just seems like it's quite out of date compared to the blog?

I'm curious to know if you used Perch to calculate the league table results from fixture results on the Dungannnon site? I have an old site built on a custom CMS that I am hoping to port to Perch Runway - it features some hockey league tables so I'm trying to figure out the best approach to building this in Perch! I'm guessing leagues, teams and fixtures would all be separate collections. The fixtures collection would use Perch related tags to allow editors to choose the teams and league for each fixture. The main challenge after that is to compute the league table from the fixture results!

Hi Adam

The Dungannon site is built on the standard version of perch.

In short no i didnt use perch to calculate the table.

The table is quite simple and is just a content area with a title and a repeating region with the fields required for the table row in it. It also has a checkbox to select if the team is Dungannon so that it will be highlighted by a CSS class. Using a repeating region enables the order to be changed easily and only the numerical values need to be updated after each game week.

Im sure it could be made more complex however with rugby they get bonus points if they score 4+ tries or lose and stay within 7 points so would be complicated to have it populate the table automatically from the score.

With them having multiple teams i have set up two category sets one for the team and another for the season. This lets me filter the fixtures and archive old results/fixtures

Thanks for the explanation Neil - you've achieved an impressively dynamic site using standard Perch!