Trimack
Trimack

Reputation: 4213

Dynamic form ASP.NET MVC

My problem is as follows. I have a system to create accounts. However, different users can set different attributes to the created account. That means I get a dynamic form with different attributes for different users. How should I process such a form?

Upvotes: 0

Views: 684

Answers (2)

J.W.
J.W.

Reputation: 18181

It looks like you need hide/show some HTML elements based on the user selection. Take a look at jQuery to manipulate the form element on the client side.

Upvotes: 0

Richard
Richard

Reputation: 22016

Once you have the client side sorted out with jQuery then you probably want to process the form values based on whether there is an entry of any kind. Look to use the following on the controller to get the entire form collection:

public ActionResult AddUser(FormCollection formvals)
{
    //Check for existence of form values and save as appropriate

    return View();
}

Upvotes: 1

Related Questions