1
votes

In Play! Framework, I have a form Form[Device]

For input values I use @testarea

@textarea(deviceForm("model"), '_label -> "Model", '_help -> "")
    @textarea(deviceForm("distributor"), '_label -> "Distributor", '_help -> "")
    @textarea(deviceForm("os"), '_label -> "Manufacturer", '_help -> "")</code>

How can I just get a value from form and print it? Not in the input filed.

Thanks.

2

2 Answers

1
votes

Just call .value on it like so:

@deviceForm("distributor").value
-1
votes
public Result hello() {
        DynamicForm requestData = formFactory.form().bindFromRequest();
        String model = requestData.get("model");
        String distributor = requestData.get("distributor");
        String os = requestData.get("os");
        return ok(model + distributor + " " + os);
    }

Assumption :

  • You are using Play-Java
  • your data not related to Model i.e you don't want to save it to database, you just want to gets its values.

please have a look at official docs.