Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@repeatWithIndex
@(field:Field, min:Int=1)(f: (Field, Int) => Html)
@{
(0 until math.max(if (field.indexes.isEmpty) 0 else field.indexes.max + 1, min)).map(i => f(field("[" + i + "]"),i))
}
@repeatWithIndex(myForm("field"), min=1) { (field, index) =>
@index
@helper.inputText(field("another_field"))
}
@jakob85

This comment has been minimized.

Copy link

@jakob85 jakob85 commented Jun 13, 2013

This is great! Thank you!

@cnicodeme

This comment has been minimized.

Copy link

@cnicodeme cnicodeme commented Jul 3, 2013

This is perfect ! Thanks !

@alissapajer

This comment has been minimized.

Copy link

@alissapajer alissapajer commented Dec 6, 2013

Thanks! Just used this successfully!

@techmag

This comment has been minimized.

Copy link

@techmag techmag commented Apr 13, 2015

Get's my vote... ran into a situation that required exactly this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment