I want to remove the slash (/) between day/month/year in date format, in Symfony 1.4, when use
<?php echo $form['birthday']->renderRow(array('class' => 'date')) ?>
Which result in:
<tr>
<th><label for="profile_birthday">Birthday</label></th>
<td>
<select class="date" name="profile[birthday][month]" id="profile_birthday_month">
<option value="" selected="selected"></option>
<option value="1">01</option>
...
<option value="12">12</option>
</select>
/
<select class="date" name="profile[birthday][day]" id="profile_birthday_day">
<option value="" selected="selected"></option>
<option value="1">01</option>
...
<option value="31">31</option>
</select>
/
<select class="date" name="profile[birthday][year]" id="profile_birthday_year">
<option value="" selected="selected"></option>
<option value="2006">2006</option>
...
<option value="2016">2016</option>
</select>
</td>
</tr>
But I want:
<tr>
<th><label for="profile_birthday">Birthday</label></th>
<td>
<select class="date" name="profile[birthday][month]" id="profile_birthday_month">
<option value="" selected="selected"></option>
<option value="1">01</option>
...
<option value="12">12</option>
</select>
<select class="date" name="profile[birthday][day]" id="profile_birthday_day">
<option value="" selected="selected"></option>
<option value="1">01</option>
...
<option value="31">31</option>
</select>
<select class="date" name="profile[birthday][year]" id="profile_birthday_year">
<option value="" selected="selected"></option>
<option value="2006">2006</option>
...
<option value="2016">2016</option>
</select>
</td>
</tr>
You can change the date format for the widget in your form class. Add the following code to the
configure()method inlib/form/doctrine/MyForm.class.php:Replacing the widget name
foowith the appropriate name in your case. Hope this helps 🙂Edit:
You can find more information on sfWidgetFormDate and other widgets here