Help Desk

Required Fields in Community Events

  • Posts: 298 Topics: 108 Answers: 1
    | Permalink

    Hi Casey,

    according to your tutorial I made a custom field a required field, which works great! 🙂
    https://theeventscalendar.com/change-required-fields-on-community-event-submission-page/

    Additionally I wanted to make the field “Venue” a required field as well, but it’s ignored.
    Do you have any idea, why it doesn’t work for the Venue?

    function add_required_fields() {

    if ( ! empty($_FILES[‘event_image’][‘name’]) )
    {
    return array(
    ‘post_title’,
    ‘post_content’,
    ‘EventStartDate’,
    ‘Venue’,
    ‘_ecp_custom_1’
    );
    }
    else
    {
    return array(
    ‘post_title’,
    ‘post_content’,
    ‘Venue’,
    ‘EventStartDate’
    );
    }

    }

    add_filter(‘tribe_events_community_required_fields’, ‘add_required_fields’);

    Best regards,
    Oliver

    Posts: 3519 Answers: 115
    | Permalink

    Oliver,
    Sorry to hear you’re having trouble here, but hopefully I can help. Try using ‘venue’ in all lowercase to see if this fixes the issue. I’ve also updated our tutorial to reflect this as well. Give that a shot and let me know if it fixes the issue.

    Thanks! 🙂

    -Casey-

    Posts: 3519 Answers: 115
    | Permalink

    I just wanted to follow up and see if you’re all set here or if you still have further questions. Just let me know if you need further help or if I should go ahead and close out this thread. Thanks! 🙂

    -Casey-

    Posts: 298 Topics: 108 Answers: 1
    | Permalink

    Sorry for my late reply – I was on vacation 😉

    Unfortunately this doesn’t solve the problem. If I change it to lower case it always calls the custom_error_message-function – regardless if I select an already existing venue or if I fill out the venue fields.

    I tested it on two test systems. Can you reproduce this behavior on your system?
    Is this maybe the case because the venue is an object, which consists of several fields?

    Best regards,
    Oliver

    Posts: 3519 Answers: 115
    | Permalink

    Oliver,
    You’re correct. The Venue field will need to be handled differently, since it can possibly contain multiple values. You’ll have to pass individual fields like ‘venue[Venue]’ and ‘venue[Address]’ for example. Give that a try and see it does the trick. Thanks!

    -Casey-

    Posts: 298 Topics: 108 Answers: 1
    | Permalink

    This is a good hint, but it still doesn’t work :-/

    For normal fields (e.g. ‘EventURL’) everything works fine, but it doesn’t work with object fields – I tried ‘venue[Venue]‘, ‘venue[Address]‘ and ‘organizer[Organizer]’. Can you reproduce this behavior on your system?

    There is another thing that I realized: when using the object fields, these fields are getting wiped when the page is reloaded and the custom error message appears. All the other fields contain the values that have been typed in before.

    Regards,
    Oliver

    Posts: 18146 Topics: 17 Answers: 973
    | Permalink

    Hi Oliver:

    Unfortunately, the way things work, using string representations of array keys isn’t going to work (in a sense, you are asking the system to look for a submitted field called array[key] rather than the presence of element key within array).

    It’s still possible to check for the presence of these fields and throw an error – but not via the same mechanism, I’m afraid – you’d need to take a slightly more roundabout approach for this one and figure out some custom method of doing this.

    Sorry we can’t do more on this one.

    Posts: 11 Topics: 12
    | Permalink
    This reply has been marked as private.
    Posts: 298 Topics: 108 Answers: 1
    | Permalink

    Hi Barry,

    that’s sad to hear. I accept this answer, but allow me one question: does it make sense to create an event without an venue? How can I participate in an event if I don’t know where it happens? 😉

    From my point of view the venue field should be a required field in future versions of the plugins (for me it’s not an urgent issue, but maybe others think the same). Maybe you can discuss this with the developer team.

    Best regards,
    Oliver

    Posts: 18146 Topics: 17 Answers: 973
    | Permalink

    Oliver: we can’t promise an immediate turnaround on this, but we do actually have an issue in progress (a colleague just made me aware of it after discussing this thread) and so the ability to easily mark fields as required will hopefully be available in a future release.

    allow me one question: does it make sense to create an event without an venue?

    Yes, in some situations – such as virtual or online events or where the venue is a given – and forcing people to specify it would be undesirable in those cases.

    Kingconga: thanks for the feedback. Feature requests do indeed belong over here, so if you have a moment and want to post something please do feel free. We definitely appreciate your frustration but yes, this forum definitely is very much in school of ‘point you in the right direction’.

    With that said, above and beyond any feature requests that are specific to Community Events, we are conscious of the fact that our documentation and tutorial resources could benefit from some further attention. We are already making strides toward improving things there, but it is not a short term project and we can only really ask you to bear with us – because we are listening and we are keen to meet the needs of our customer base.

    I don’t think there’s too much more we can do here in this thread and I’ll go ahead and close it – but if we can assist with anything else please don’t hesitate to create new threads as needed.

    Posts: 3443 Topics: 13 Answers: 199
    | Permalink

    Hi there,

    I just wanted to drop in and update you on the status of this issue. We are working on the upcoming 3.7 release and are happy to say that a fix for this issue will be included. Please keep an eye on your Updates and Plugins pages for an update prompt. If you have any trouble or continue to see this issue after updating, please start a new thread and we can assist you from there. Thank you for your patience while we worked on this issue.

    Best,
    Leah

The topic ‘Required Fields in Community Events’ is closed to new replies.