Generating forms for array & add elements dynamically

Hi,
I’ve been struggling with this for quite some time now, but I feel like
I’m almost there. What I have is a model “online_score” which has an
array of
"online_score_url"s. Those urls have 2 attributes: “url” and
“description”. I have to create a form that enables you to edit the
contents of that array with those "online_score_url"s. Editing and
removing work. Adding doesn’t.
I have the view part working but I have one big problem, being that the
dynamically added urls attributes don’t come in the hash for the url
attribute of “online_score”. I (think I) know why that happens, but not
how to fix it. Why it happens has to do with the “for” attribute in the
html code. For fields generated in the “new” view that attribute is as
follows: ‘for=“online_score_url_attributes_0_url”’, but when I add it
dynamically its like this:
‘for=“online_score_item_url”’. If you look at the source code below I
think its obvious why that happens, but now to fix it…

I guess the thing to do is make sure that the “for” attribute gets set
correctly? How? Or is there a better way?

Code that matters in attachment

Thanks, I hope somebody can help me.