How to require fields that have no "required" setting?

How to require fields that have no "required" setting?

by Clay Burell -
Number of replies: 4
The title says it all. Fields like "date" do not have the "required" option, and we need to require them.
 Moodle 3.1.2.
Thanks!


Average of ratings: -
In reply to Clay Burell

Re: How to require fields that have no "required" setting?

by William Lu -
Picture of Particularly helpful Moodlers

The Date field comes with some characters: 

1. It pre-filled with the current Date. If you are requiring other Date, users have to manually alter it.

2. In Moodle2x, whenever you update your entry, the Date automatically adds one day. The bug has been fixed now, but if you are still in an old version, please have a double check.

3. When you export your entries to a spreadsheet, the Date displays as a serial number, which you have to use a formula to convert it back.


To work around these, you can use 'number', 'text'  or 'dropdown' (preferred)  field to produce Date/Month/Year, if you need them all.

Then, you can 'require' your fields.


HTH


Average of ratings: Useful (1)
In reply to William Lu

Re: Database menu dropdowns horizontal in one table row: how?

by Clay Burell -

Hm. Tried "menu" for "Start Day," "Start Month," and "Start Year" by putting all fields in one table row in template.

When saved, they show up vertical instead of horizontal.

Is the trick to make them horizontal easy? Otherwise a number field looks better.

Thanks again!

In reply to Clay Burell

Re: Database menu dropdowns horizontal in one table row: how?

by William Lu -
Picture of Particularly helpful Moodlers

Yes, the trick is 'table in table'.

Create a table which has 1row, 3 columns, every property set to 0.

Insert this table into one cell in your templates.

<table width="0" border="0" cellpadding="0" cellspacing="0">
  <tbody>
    <tr>
      <td>[ [date] ]</td>
      <td>[ [month] ]</td>
      <td>[ [year] ]</td>
    </tr>
  </tbody>
</table>