Allow to define placeholder for fields

The placeholder attribute was designed to give the user a visual hint of what the user needs to enter on the fields. Placeholders are shown only when the field are empty and they are supported by HTML and also on GTK3

When designing forms it’s great to include a placeholder so the user knows has some clue about the information is requested on each field. For example the following can be used:

  • When the Char field represents an email, include a placeholder with an example email. I.E: example@example.com
  • For opportunity description the company may include a visual hint to include specify information, for example: Contact person and contact details.

The information included on the placeholder may be different on each database so I propose to include a translatable Char field on ir.model.field so the system administrator can define which placeholder should be shown for each field. If this information is set, the placeholder will be shown on the clients.

Implementation
https://bugs.tryton.org/issue8524

2 Likes

I think it would be better to have it as a Char and XML attribute. Or another option would be to use the first line of the help.

Now I think we should be careful about its usage because a form filled with placeholder can become confusing especially because we already have label always visible.

Agree, the Char field will be used to set the XML attribute if not present.

For me placeholder and help are two diferent things. While the help explains the usage of the field the placeholder is a hint about what is expected to be included.

I do not thing we should include any placeholder by default, but let the developer/administrator customize them for each database.

Why not? I think we would be agreed in some many cases where a default value for a place holder fits well for most of the users…

If it fits well for most of the users I agree that it will be good to include them but for now we did not find the any field that should require a placeholder. Only found the need when developing custom modules or adapting some modules for customer needs (like the example of sale oportunity I posted).

I think the name on Party should have a placeholder: John Doe or Acme Corporation
So many people does not understand that the full name should be put there.

I’ve just uploaded an implementation in Issue 8524: Add placeholder for fields - Tryton issue tracker

1 Like