Adding to play documentation on forms?


(Mark Hammons) #1

I have looked through the form handling documentation on play, and it’s pretty sparse compared to the plethora of features available with form helpers, validation constraints, etc. For example, today I found these:


    '_label -> "Custom label", which allows you to specify a custom label on your input.
    '_id -> "myCustomId", which allows you to specify the id of the input.
    '_help -> "Custom help", that allows you to add some helper text.
    '_showConstraints -> false, that enables you to omit the constraints shown in the form.
    '_error -> Some(FormError("error-key", Seq("error message"), Seq.empty)), to specify some custom error.
    '_showErrors -> false, to hide errors from users.

Apart from label, I had no idea about these flags, which is a pity because they solved some issues I was having. And as far as I’m aware, these are not documented. It’d be great if they could be documented (or if you could point me to where I could modify the documentation to include information on these settings).


(Marcos Pereira) #2

Hi @markehammons,

For Java, this looks like the correct place to add it:

https://www.playframework.com/documentation/2.6.x/JavaFormHelpers

And for Scala, they are already documented here:

https://www.playframework.com/documentation/2.6.x/ScalaCustomFieldConstructors

Which may not be the best place. What do you think?

Best.


(Mark Hammons) #3

Thanks for the response. I was curious specifically how to edit the documentation, but I’ve found out how. I think the scala documentation of that info should be move into Form helpers instead of custom field constructors, since those arguments don’t actually apply to a custom field constructor but rather to the default field constructor.

I’ll create a pull request to that effect.