Lost of form data on validation error

I don't know how ROR way to handle multiple records, but I have same issue with you. I have custom input. In my view, for one input, I have four radio buttons and each of them is accompanied by text field. If the validation gives error, the radio button is still on but the text field will be empty. The solution? I use a bunch javascript in the view (off course I put the detail of function in controller helper) to update the text field.