Dynamically adding data entry forms
So, the main problem is my lack of knowledge. I have an MVC web-application with Create page, that should contain some general data such as number etc, and my task is to add extra forms to type data dynamically, input data there and extract it in POST method in controller. When I do it this way (screenshots attached) I dont get any data that I input there. Is there a more proper way to achieve my goal?
4 Replies
The easiest way would be probably to send the whole form with JS
Other than that... dynamic forms are usually a pain, but this SO answer might be useful: https://stackoverflow.com/a/46854686/6042255
Yes it is helpful, thanks! I'm gonna look more deeper into this
Well because im not using partialView i thought i'll write this html code in JS instead
I've had <select asp-items"@Model"> there that worked fine
now it doesnt
This IEnumerable<SelectListItem> does contain data, but it isnt avaliable as option somehow
Preloaded <select> has data in it, the one that i dynamically add - doesn't
😦
Stack Overflow
How do you append a select with a asp-item tag helper
I have a functionality where I append a select html when a button is clicked using jQuery. I already have a select which uses a asp-item tag helper to fill it with my corresponding model. The platf...
I just solved this problem, and there was no problem at all...
All I had to do is to add Index as field to Appartment and change partial view to
and this way my data will transfer from partialview to POST method in controller
everything else was perfectly fine
😢