How to repeat fields depending on required numbers