Help Desk

Adding "organizer" to required field filter prevents it from being saved

  • Posts: 42 Topics: 19
    | Permalink

    [From the developer I am working with, Carole:]

    I followed https://tri.be/change-required-fields-on-community-event-submission-page/ and added a filter to specify additional required fields on the community/add (and edit) page. When I add ‘organizer’ to the array of required fields, changes made to the organizer of an event aren’t saved. As near as I can tell, here’s the basic repro:

    1. Add events via the community plugin (I’m signed in as an admin so they’re listed under My Events). Include an organizer (or choose an existing one).
    2. Add a filter for tribe_events_community_required_fields that includes ‘organizer’. I also included ‘post_content’ and ‘post_title’
    3. Edit an event via the plugin. Change the organizer to another value.
    4. Save the event.
    5. When taken to My Events page, click the Edit link for the event you just changed.
    OBSERVED RESULTS: The organizer is still the original value,
    EXPECTED RESULTS: The organizer is changed to the value entered in step 3.
    6. Remove the filter in step 2 or just remove ‘organizer’ from the array
    7. Repeat steps 3-5
    OBSERVED RESULTS: The organizer has been changed to the new value.

    After finding https://theeventscalendar.com/support/forums/topic/required-fields-in-community-events/ and https://theeventscalendar.com/support/forums/topic/change-required-fields-on-community-event-submission-page/, I took a closer look at the tutorial. While the tutorial sort of warns about using indexes in fields, it doesn’t warn about using ‘venue’ and ‘organizer’. If no more information can be added about making these fields required, those values should be removed from the list of Possible Field Names to Include, as including them introduces a bug.

    Ideally, the tutorial would show, or at least hint, at what’s needed to make organizer and venue required. Can I return an array of an array, ie., return array(‘organizer’, array(‘Organizer’)) to require the Organizer[Organizer] field? Upon closer inspection, I see that I’d still have to account for the id being selected or all the fields having values. At that point, it seems that JavaScript is probably better than using the filter. OK, yeah I get why the tutorial stops short of that.

    But I still contend that the tutorial implies one should add ‘organizer’ in the filter, but doing so results in breaking behavior. And that needs to be addressed.

    Posts: 3519 Answers: 115
    | Permalink

    pickleshy,
    Thanks for reaching out here. The tutorial does list all possible fields to include, but includes a note about needing further code to successfully validate the organizer and venue fields (screenshot), since those fields are more complex. As stated at the of top of this tutorial (screenshot), it’s just designed to serve as a starting place and not be a complete solution.

    Hopefully that helps to answer your questions, but let me know if I can clarify further. 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 have further questions or if I should go ahead and close out this thread. Thanks! ๐Ÿ™‚

    -Casey-

    Posts: 42 Topics: 19
    | Permalink

    Yes, we’re all good. Thanks!

    Posts: 3519 Answers: 115
    | Permalink

    Great! Thanks for confirming that this got you sorted. Since it looks like you’re all set, I’m going to mark this thread “Answered” and close it out.

    Feel free to create a new thread if you have further issues.

    Thanks!

    Cheers,
    Casey

The topic ‘Adding "organizer" to required field filter prevents it from being saved’ is closed to new replies.