I have a DropDownListFor in a form in which I list all currently available options. Now, I want to provide an “New…” alternative. Selecting this would display a new textbox in which a new alternative can be created.
I have added the alternative, bound some javascript to display the additional form (generated with EditorFor). What remains is how to validate the input. Do I have to create a custom model binder for this scenario? Essentially what I want is either an existing value is chosen from the drop down, or all properties in the additional fields are filled in according to validation rules.
I’m using C# for the backend, though I doubt that matters.
When you fetch the next dropdown with ajax you need to bind that input to the jquery validiation framework