Forum

Thread tagged as: Problem, Events

Images vanishing in events

I've recently upgraded a sit to latest versions of Perch (2.5.4), Blog (4.1), Events (1.9).

After much trauma finally got assets and blog working reasonably well.

I come to events and all seems OK but when I click 'save' my image simply vanishes. Ie I'm in Perch, changing the contents of an event. I can click on 'Select or upload an image' and navigate to assets, choose an image, it gets added into the event screen all seems OK but when I hit 'Save' it simply disappears from the screen as though it had never been added.

Any ideas of how to fix this?

Cheers - Mark

mark buckley

mark buckley 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show me your template?

<div class="vevent">
    <h2 class="summary"><perch:events id="eventTitle" type="text"  label="The name for this event"  order="10" /></h2>

    <p class="dtstart"><span class="value-title" title="<perch:events id="eventDateTime" format="c" />"><perch:events id="eventDateTime" format="%c" order ="1" help="This is date after which the event will no longer be displayed" /></span></p>

    <div><perch:events id="eventDescHTML" type="textarea" label="Event description" order="10"  textile="true" encode="false" editor="markitup" size="l autowidth" required="true" imagewidth="440"/></div>

    <p class="category"><perch:events id="category_names" encode="false" /></p>

    <perch:events id="image" type="image" width="240" height="180" crop="true" suppress="true" label="Image/photo"  order="1"/>

    <div id="tester" style="width: 500px; font-size: 0.8em; font-variant: small-caps;">
        <perch:events id="image-caption" type="text"  label="Image caption" help="The image caption will be displayed under the image" title="true" order="2"/>
    </div>

    <perch:events id="excerpt" type="textarea" label="Excerpt (brief description for side panel)" textile="true" editor="markitup" height="100" order="3" size="s "help="Length guide, approx 12 - 40 words"/>
    <perch:events id="joininginstructions" type="textarea" label="Joining instructions" textile="true" editor="markitup" size="xs"/>

    <perch:if exists="image">
        <img src="<perch:events id="image" type="image" label="Image" width="440" height="330" crop="true" />" alt="<perch:events id="eventTitle" />" />
    </perch:if>


    <perch:events id="leader" type="text" label="Walk or Talk leader/presenter" required="false" title="true" order="3" suppress="false" help="Please enter the name of the Walk leader or the Talk presenter"/>
</div>

<div class="display-date" style="width: 500px; font-size: 0.8em; font-variant: small-caps;">
    <perch:events id="display-date" type="text"  order="1" label="Display date/time" help="This is the event's date/time as it will be displayed" title="true" required="true"/>
</div>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Is it the field with id="image" ?

Yes it is.

is there something obvious that's wrong? I cant see it.

cheers - Mark

Hi Drew, If you (or anyone else) need any more information on this one please do let me know.

Cheers - Mark

Rachel Andrew

Rachel Andrew 394 points
Perch Support

You have dashes in your ID values.They should be lowercase letters, numbers and underscores only. So I would start by ensuring that your template is correct.

BTW - It's Sunday afternoon, we do try and get back to people on the weekend as much as possible but posting repeatedly won't speed a response up at any point. In fact it is likely to have the opposite effect as we work up the queue from the oldest thing to have been posted to.

Thanks for your reply Rachel.

I have removed the dashes as suggested, unfortunately the problem persists. It seems to be the id="image" field that is causing the problem as highlighted above by Drew.

This is one of the earliest Perch sites I did several years ago and has just been updated as above. I must confess I've never had a problem with the hyphenated id values before, presumably that only became an issue with Perch 2.5?

It's actually Sunday evening and I'm astonished you're replying at all but really appreciate your help.

Any idea where to go from here? I can supply a login (under separate cover of course) if you'd like to see the issue from the user perspective.

Thanks again for your out-of-hours support.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Is it different for new events vs old events?

To be honest, my feeling was that it was happening the same with old and new. However, now I have another problem. I can make changes in Perch on the Events screen and when I press save the changes are still there on the screen. But there's no confirmation that the changes have been saved (no green confirmation line) and indeed when I refresh the site the changes aren't there. Ie I'm not managing to save any of the changes at all.

I think I'll have to take another look in the morning when I'm a bit fresher.

Thanks for all your help.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you turn debug on and let me know what it outputs at the bottom of the edit page after saving?

OK, this is what I get after pressing 'save' - it doesn't actually save it though:

DIAGNOSTICS:
SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r
WHERE u.roleID=r.roleID AND u.userEnabled='1' AND u.userID=1 AND u.userHash='eb23442f6c5fd2e8f8d541d4b92f359c'
LIMIT 1
UPDATE perch2_users SET userHash='11c28274469095c58ddcff028ee8a08c' WHERE userID=1
SELECT p.privKey FROM perch2_user_privileges p
SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID
SELECT * 
FROM perch2_events_categories ORDER BY categoryTitle ASC
SELECT * FROM perch2_events WHERE eventID = 1
SELECT categoryID FROM perch2_events_to_categories WHERE eventID = 1
SELECT c.*
FROM perch2_events_categories c, perch2_events_to_categories e2c
WHERE c.categoryID=e2c.categoryID
AND e2c.eventID='1'
Using template: \templates\events\event.html
Queries: 9
Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you removed any of the fixed fields from your event.html template?

Hmmm, this template is pretty old. It was OK up until recent upgrade. So I might have done ages ago but not recently to my knowledge.

I'll try replacing it with the default that comes with events 1.9 to see if that helps.

More anon...

It worked fine with the default event.html. So I started to narrow the differences and it turned out to be that there was 'required="true"' in the line below. Don't ask me how it got there and no idea me why it should stop me being able to do a 'save' successfully but it seems (nearly) fine now.

Only problem I'm now left with - and everything else seems fine - is that i cant remove an image. This is the case even when I use the virgin/vanilla event.html that came with 1.9. I can change it OK I just can't remove it. Any clues welcome.

Many thanks for all your help.

Cheers - Mark <div><perch:events id="eventDescHTML" type="textarea" label="Event description" order="10" textile="true" encode="false" editor="markitup" size="l autowidth" required="true" imagewidth="440"/></div>

OK, I've now discovered a workaround for not being able to remove the image.

It's this, you must quit the events page, go to another one, for example, a blog page and return. Then the remove image option works. If you stay on the page in events, add an image and then try to remove it without having left the page it won't remove. At least not in my set up.

Thanks again for all your help earlier.

I'm marking the latest Perch Support comment as 'solution'.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you attempting to remove an image before you've saved the entry?

Thought I'd already replied, sorry if this appears twice...

I'm definitely saving it, returning to the browser, pressing refresh, seeing the newly added image, returning to Perch trying to remove the image but it isn't going. If I go it in, say blog, and return to the event, then I can remove it.

It's not a problem, the workaround is fine.

Thanks again.