score:0

I've been struggling with this problem today: I'm using @repeat helper and I've found the constraints being tied to the single repeated field's name (i.e. "field_name") instead of each repeated field (i.e. "field_name[0]")

The solution I've found so far is just to rebuild the field, using the right constraints.

@repeat(theForm("repeated_field")) { field =>
            @myInputNumber(
                Field(
                    form = theForm, name = "name", 
                    constraints = theForm.constraints.find(_._1 == "repeated_field").get._2,
                    format = field("field_name").format,
                    errors = field("field_name").errors,
                    value = field("field_name").value
                ))
    }

Of course this code is just an example, you should probably check for empty Constraints or existing ones.

Hope to be helpful, Pietro


Related Query

More Query from same tag