angular-xeditable icon indicating copy to clipboard operation
angular-xeditable copied to clipboard

Dynamic blur values

Open yeeland opened this issue 7 years ago • 5 comments

We recently ran into a feature request where users would like editable inputs to cancel on blur if nothing has been entered but ignore if the input has text. We attempted to set the blur attribute to something dynamic but it looks like the form only checks for the blur value in the compile step here.

Can anything be done to allow for a dynamic blur value? Or can we add a cancelIfEmpty option for blur?

yeeland avatar Dec 15 '17 17:12 yeeland

Can you explain more what it is you are trying to achieve? Are you trying to prevent save calls to the back end by cancelling if nothing has submitted?

ckosloski avatar Dec 15 '17 17:12 ckosloski

@ckosloski originally, we had textareas that would cancel whenever you blurred but users would type long content in those textareas, click outside of the form, and lose all that they had typed in the input. However, they do like the convenience of being able to click outside of the form if they haven't typed anything instead of having to find and click the cancel button.

yeeland avatar Dec 15 '17 19:12 yeeland

Why not just set the blur to submit?

ckosloski avatar Dec 15 '17 20:12 ckosloski

@ckosloski To answer your second question in the original comment, we are looking to avoid a backend call unless the user has hit the save button.

yeeland avatar Dec 15 '17 21:12 yeeland

Why can't you check the existence of data before submitting to backend? Or maybe add a onbeforesave call that returns false if no data was entered (and doesn't call the backend)

ckosloski avatar Dec 15 '17 21:12 ckosloski