Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Topic started by: NoRad on January 31, 2005, 12:48:56 AM

Title: Calendar - Default Date Check
Post by: NoRad on January 31, 2005, 12:48:56 AM
I have users posting topics as events only in a certain forum. Those users are stupid and sometimes forget to set the date for their event. Is there a way to have the default date empty and require them to select the fields before the post is allowed?
Title: Re: Calendar - Default Date Check
Post by: [Unknown] on March 27, 2005, 06:37:40 AM
Post template, find:

<select name="day" id="day">';

// This prints out all the days in the current month - this changes dynamically as we switch months.
for ($day = 1; $day <= $context['event']['last_day']; $day++)
echo '
<option value="', $day, '"', $day == $context['event']['day'] ? ' selected="selected"' : '', '>', $day, '</option>';

echo '
</select>


Replace:

<select name="day" id="day">
<option value=""></option>';

// This prints out all the days in the current month - this changes dynamically as we switch months.
for ($day = 1; $day <= $context['event']['last_day']; $day++)
echo '
<option value="', $day, '"', $day == $context['event']['day'] ? ' selected="selected"' : '', '>', $day, '</option>';

echo '
</select>


And then find:

<form action="', $scripturl, '?action=', $context['destination'], ';', empty($context['current_board']) ? '' : 'board=' . $context['current_board'], '" method="post" name="postmodify" onsubmit="submitonce(this);" enctype="multipart/form-data" style="margin: 0;">

Replace:

<form action="', $scripturl, '?action=', $context['destination'], ';', empty($context['current_board']) ? '' : 'board=' . $context['current_board'], '" method="post" name="postmodify" onsubmit="submitonce(this); return !document.getElementById(\'day\') || document.getElementById(\'day\').selectedIndex != 0;" enctype="multipart/form-data" style="margin: 0;">

That should, theoretically, work.

-[Unknown]