Mike
Mike

Reputation: 797

How to suppress the Play framework's output of data types in forms

Using the helper functions of the Play framework to create form elements (particularly text inputs) results in inputs being labeled with "required", "numeric", "real", etc.

I want to suppress the output of all but "required". How can I do this? Is there a per-input way to modify this text?

To demonstrate, here's an example of the text, placed below the input:

enter image description here

Which are created with:

@inputText(
    propertyForm("totalRooms"),
    '_label -> Messages("properties.add.totalRooms"),
)

They can't trivially be removed with CSS, since the "required" and "numeric" (etc) labels all have the same class (and it'd be ideal to be able to specify what text goes there, rather than completely remove it).

Upvotes: 1

Views: 89

Answers (1)

Agemen
Agemen

Reputation: 1535

I think you may use internationalization files (the "messages" file) to override them. You may be able to associate an empty String to the key. Some of the keys I use that come form Play are :

# --- Constraints
constraint.required=Obligatoire
constraint.min=Valeur minimum : {0}
constraint.max=Valeur maximum : {0}
constraint.minLength=Longueur minimum : {0}
constraint.maxLength=Longueur maximum : {0}
constraint.email=Email

# --- Formats
format.date=Date (''{0}'')
format.numeric=Numérique
format.real=Réel

Upvotes: 1

Related Questions