vitalets / angular-xeditable

Edit in place for AngularJS
http://vitalets.github.io/angular-xeditable
MIT License
1.91k stars 403 forks source link

$data does not include empty strings in onbeforesave for form #501

Closed semaja2 closed 8 years ago

semaja2 commented 8 years ago

Hi Guys,

I have an issue where when a text field is changed to an empty string, $data does not contain the variable, this then means the old data in the text field does not get changed

Is there a way to access all the values on the form?

ckosloski commented 8 years ago

Do you have a JSFiddle showing this issue? I just tried this out on an existing fiddle I had and it seems to work. Delete the text in the first name text field, change the second name text field to "awesome" and save. The first name field turns into "empty"

dunkersa commented 8 years ago

I seem to be having a similar issue. If $data is null when the form becomes editable, $data never changes no matter what I input. If there's already a value there, though, $data updates just fine.

ckosloski commented 8 years ago

Do you have a JSFiddle or Plunkr showing this issue? I did some testing locally, setting the starting value of a field to null and when I click save, the onbeforesave validation still displays the correct error.

semaja2 commented 8 years ago

Sorry I don't have any example code at the moment, but basically if the field has a value say "example" and I change it to "" when I use onbeforesave in a form, the $data does not include the field.

I assume this is due to the field being blank?

ckosloski commented 8 years ago

What do you mean by "$data does not include the field". Is there some specific test you are trying to do in your onbeforesave that is not working?

semaja2 commented 8 years ago

Apologies I created a quick fiddler and was unable to reproduce my issue, I suspect this may be a issue in my code