Dirty state for forms with collection properties

asked 2013-03-22 18:21:00 +0800

spaeth gravatar image spaeth

I have the following model:

Person - String name - Set<phone> phones

My ViewModel has following filds: - Person selected - Phone selectedPhone

My View will create a form like:

<groupbox form="@id('fx') @load(vm.selected) @save(vm.selected, before='save')">

and will expose the name in a textbox and the phones on a listbox. Everytime I selected a phone I set the property selectedPhone. The phone can be edited by using another textfields on my view.

When I change the name the dirty state of my form is updated, and this is good. When I select a Phone I can see that the property selectedPhone of my viewmodel is set. But when I change the phone using the editBox bounded to selectedPhone the dirty state of my form doesn't changed.

This is expected since I'm changing the ViewModel and not the form. But what would be the way to solve this problem, since when a phone is changed, means the Person is changed too, because there are things to save?

delete flag offensive retag edit


Hi, I am not I fully understand your question, from your description, you bind person name to form, but phone to VM? instead of form? any reason? If you bind phone to form, you won't have this issue, right?

samchuang ( 2013-03-25 01:46:39 +0800 )edit

I'm trying to avoid the situation in which the form is marked as dirty just changing the selected phone. My goal is to have the form marked as dirty just if the user changes something within the phone object.

spaeth ( 2013-03-25 09:02:12 +0800 )edit
Be the first one to answer this question!
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2013-03-22 18:21:00 +0800

Seen: 16 times

Last updated: Mar 22 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More