I am binding a text input to a model property. When the value changes, I want to save the changes to the server. I have this part done already. However, I need to run some validation on the new value before saving the model. Mostly I want to make sure that the text input isn't empty.
The general idea I'm working on is changing the title of the model in the view. I want to make sure that the new title isn't empty before saving the model back to the server. I have validation set on the server, but I would like to avoid wasting an ajax call to the server, since I already know empty values won't work.
How can I accomplish some simple validation like this when binding form elements to the model?
I am binding a text input to a model property. When the value changes, I want to save the changes to the server. I have this part done already. However, I need to run some validation on the new value before saving the model. Mostly I want to make sure that the text input isn't empty.
The general idea I'm working on is changing the title of the model in the view. I want to make sure that the new title isn't empty before saving the model back to the server. I have validation set on the server, but I would like to avoid wasting an ajax call to the server, since I already know empty values won't work.
How can I accomplish some simple validation like this when binding form elements to the model?