Using webform I have created event registration for a nightshelter that runs continuously for 4 months at various different churches. I have set this up as a repeating event so each day is a different event - there are good arguments for doing it this way. I would like to have the 'current' event - which is today's nightshelter - as the default event. Is that possible or is there a hook I can use? Having a default event each day is the problem, otherwise the user is going to have to choose from 122 events!


If this is on Drupal, you could generate a View that displays links to the webform and form the link with each event's event id in the URL.

Add a new view of CiviCRM Events.

This will add the event id field. Under settings for that field, check Exclude from Display and make sure for Thousands Marker you change it from comma to none.

Add the start date field.

Add a Global Custom Text field. In the Text area put Register for this Event (or something like that). Under Rewrite results, select output this field as a link. This is where you will link to the webform prefilled with the correct event id. I don't do much work with events, but according to the help on the webform integration:

Allow events in "User Select" mode to be auto-filled from URL.

Example for "Register all": http://example.com/node/{node.nid}?event1={event1.event_id},{event2.event_id}

Example for "Register separately": http://example.com/node/{node.nid}?c1event1={event1.event_id},{event2.event_id}&c2event1={event3.event_id}

So your rewrite might be something like node/1?event1=[id] where node/1 is the path to your webform.

On the webform civi settings under event, make sure you have "Allow events to be autoloaded from URL checked."

Then under the view's filter section add start date, change the operator to "Is greater than," in the Value area, change it to An offset from the current time such as "+1 day" or "-2 hours -30 minutes" and in Value field enter Now.

This should give you a view of all upcoming events with a link to the webform prefilled with the correct event.

You'd need to add some more filters to get just what you need and add a sort by start date, but this should get you in the ball park.

  • It is Drupal - can you explain a bit more how Views could generate a default event- I guess based on today's date?
    – Andy Clark
    Sep 27 '15 at 16:08
  • Added detail to answer.
    – pmoz
    Sep 27 '15 at 16:38
  • Thanks for this very detailed explanation - almost there with this!
    – Andy Clark
    Sep 27 '15 at 17:54
  • Terrific - worked 100%. Thank you so much! I have not used Views much but obviously it's very useful stuff to know.
    – Andy Clark
    Sep 27 '15 at 18:40
  • Glad it worked.
    – pmoz
    Sep 27 '15 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.