Our Biggest Sale Is Here
Up to 70% Off
Get the Deal

How to choose editor input types in wpDataTables

Say your editable task table has a status that should always be one of three values, a due date and a place to attach a file. If users type everything into plain text fields, you end up with “done”, “Done” and “finished” in the same column and dates in five formats. Editor input types fix that: for each column you choose the field users get in the edit window, such as a dropdown with fixed values, a date picker or a file upload button.

Where do I set the editor input type?

Set it in the Editing tab of each column’s settings, in Editor input type. The table must be editable first.

  1. Open the column settings. In the table editor, click the settings button in the column header, or open the column from Column List above the preview.
  2. Choose the input. Open the Editing tab and choose an option in Editor input type.
  3. Set the extras. If needed, turn on Cannot be empty under Column cannot be empty, or choose Predefined value(s), described below. For a selectbox, you can also turn on Enable search in select-box for entry editing under Search in select-box for editing.
  4. Save the table. Click Save Changes.
The Editing tab of the Status column settings with the Editor input type list open, the Cannot be empty switch, and the Predefined value(s) and Search in select-box for editing fields
Choosing how a column is edited, shown as overlapping panels: (1) the Editing tab of the column, (2) the Editor input type list, (3) Cannot be empty, (4) Predefined value(s), (5) search in a selectbox.

You can also ask Tabella AI in the editor to change column settings, and the change waits in the unsaved editor until you click Save Changes. Read how to use Tabella AI.

Which editor input types can I choose?

Choose the input that matches the column type and the MySQL type of the column, because the database rejects values it can’t store. These are the types:

Editor input type What users get Use it for
None No field. The column can’t be edited, and new rows get the default value or stay empty. IDs and calculated values
One-line edit A one-line text field Short text or numbers; VARCHAR or TEXT in MySQL
Multi-line edit A text area that keeps line breaks Long text; VARCHAR or TEXT. Text longer than a VARCHAR allows is cut off.
HTML editor A TinyMCE editor with bold, italic and alignment Formatted text; VARCHAR or TEXT
Single-value selectbox A dropdown with one choice Fixed values such as a status; VARCHAR, TEXT or ENUM
Multi-value selectbox A dropdown with several choices Tags or categories; VARCHAR, TEXT or ENUM
Hidden (dynamic) No visible field. The value is filled in for every new row, such as the current user or date. Values users shouldn’t type, such as who added a row
Date A date picker Date columns; DATE or TIMESTAMP
Datetime A date and time picker, without seconds Datetime columns; DATETIME
Time A time picker, without seconds Time columns; TIME
E-mail link A text field checked as an email address E-mail link columns; VARCHAR or TEXT
URL link A text field checked as a URL URL link columns; VARCHAR or TEXT
Attachment Select file, Change and Remove buttons that open the Media Library URL link or Image columns; VARCHAR or TEXT

For E-mail link and URL link, users can also enter the text to show and the address separated by ||, as described for column types. A wrong email or URL shows a notice, and the row isn’t saved.

Where do selectboxes get their values?

Selectboxes show the values set in Possible values for column on the column’s Data tab. Choose Define values list there and type the values, separated by commas, for example Not started,In progress,Done. The other choices are Read from table on page load, which uses the values already in the column, and Use values from another wpDataTable (foreign key), which shows values from another table, as described in how to connect tables with foreign keys.

What do I need for file attachments?

Users who upload attachments need the WordPress upload_files capability, because wpDataTables uses the Media Library. Keep these rules in mind:

  • Subscribers don’t have upload_files by default. Add it with a role editor plugin, such as User Role Editor, if they should upload files.
  • Only the file types WordPress allows can be uploaded, up to the size your PHP settings allow.
  • In an Image column, the table shows the thumbnail linked to the full image.

How do I make a field required or set a default value?

Turn on Cannot be empty to make a field required, and enter Predefined value(s) to fill in a default value for new rows. Both are in the column’s Editing tab:

  • Cannot be empty. The field gets an asterisk (*) in the edit window, and the row can’t be saved while the field is empty. Use it for columns that are NOT NULL in MySQL.
  • Predefined value(s). The value is filled in when users add a row, and pre-selected in selectboxes. For One-line edit, you can use placeholders such as %CURRENT_USER_LOGIN% as dynamic default values.

What should I remember about editor input types?

Set an Editor input type for every column users should edit, and pick one that fits the MySQL type of the column. Use selectboxes for fixed values, pickers for dates and times, and Attachment for files. Make important fields required with Cannot be empty, and save time with Predefined value(s).

Wait, Before You Download!

To get your hands on wpDataTables Lite, please enter your email address below. We’ll send you a direct download link and keep you updated on existing features along with helpful tips and tricks!

By continuing, I accept Privacy Policy and T&C
Mail Box