News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Calendar - Default Date Check

Started by NoRad, January 31, 2005, 12:48:56 AM

Previous topic - Next topic

NoRad

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?

[Unknown]

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]

Advertisement: