I have an MVC application which has a set of fields for contact details to be added for a person (Email, Phone, Fax, AIM… etc). Initially I present a dropdown for type of input and and input field for the corresponding data, along with a link to add a further set of fields.
When complete I have a submit button to submit the form.
I am happy with an approach for adding a further set of fields using the add link and javascript, but I can’t work out how to do this without javascript.
I would be grateful for some pointers in the best direction to solve this. I am not particularly precious about keeping the add link, it could be a button, but I would rather the url not change in the address bar.
Thanks, Richard
This is basically the client side of the answer. If you have to do it without JavaScript and without changing the URL, that basically leaves a POST.
On the server, you detect whether they clicked Add Field (add_field_submit is present) or Submit (done_submit is present). If they clicked Add Field, you add a field and serve the view. Otherwise, it’s done.