1
I have a person registration form, where I also already register her address, there arose the need to be able to register more than one address for the same person at the time I am registering her, but I can’t have one form nested inside another that only takes the address data, so what’s the best way to do that? I want to have a button, which takes only the data that was typed in the address fields and register in the database, can I do this with a Jquery that would send the data to my people controller? I don’t want to do something pop-up that appears to register the address, and I also don’t want you to redirect to another view, I wanted to take advantage of the same view of registration of people. I am using partial views, and using different viewModels.
I don’t know if the question is very clear, but you can use Jquery to upload additional partial views as the user wants to register more addresses, and post this as a collection on
model
.– RSinohara
you want to have a button that sends the values of the address related fields to the controller and save in the database ?
– Thiago Friedman
Man, from what I understand, the form is one, it doesn’t need another. You must have a button that persists the address in the bank, passing as FK the customer ID. By persisting, it saves and clears the form. This upload I would do by jquery, for the controller and there I would call the model that would make the persistence.
– pnet
@Rsinohara I can have jquery add another partial address view, and then I’ll have two address collections sent to controller?
– Aesir
@Thiagofalcão I want to know if this is a "good" way to do...
– Aesir
@pnet yes, but this button, need to send only the address data, not the whole form, and it can not clear the form, because the person needs to continue with the registration of the person, the address is only a part...
– Aesir
Yes, a type like this: In jquery/ajax you would send this. I will reply as it would be done.
– pnet
The registration of the person is being carried out... therefore, if I understand correctly, the model would need to contain a collection of addresses.
– RSinohara