vitalets / angular-xeditable

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

the issue while the closing the input area when the input field was being in error or invalid state #765

Open satyanarayanaAmzur opened 4 years ago

satyanarayanaAmzur commented 4 years ago

Hi Vitaliy Potapov,

i did verified and implemented the solution for the issue the issue while the closing the input area when the input field was being in error or invalid state it was allowing the hide without error validation showing in view,so i did verified the issue and fixed it but unable to create pull request to the current branch please do it from your side as per the below logic block,if you updated it it will clears my blocked issue from weeks

 **$cancel: function () {
      var onHideConditionString='';
      if (!this.$visible) {
        return;
      }
      // self cancel
      this.$oncancel();
      // children's cancel
      angular.forEach(this.$editables, function (editable) {
        onHideConditionString=editable.elem.context.childNodes[1].innerHTML; //editable.elem.context.childNodes[1].innerText;
        editable.cancel();
      });
      // self hide
          //To restricting the hide functionality when the form was updated with validation error or invalid 
          if(onHideConditionString.length!=0){
            this.$hide();
          }
    },**

or please do required changes in it Potapov

thank you very much

ckosloski commented 4 years ago

Can you provide a jsfiddle or plunkr showing what the issue is that you are fixing? Or explain in more detail what the issue is? I don't see any issues in using the cancel button if a field is displaying a validation error.

satyanarayanaAmzur commented 4 years ago

image

if we click on cancel then it was not holding that the field can't be blank

image

but it won't wait and says that there is an error validation is pending for the above controller and same was happens when we click on out side the "x Editable" block in my case

i just verified the point here from the documentation as below

image

so i just wanted to update the actions based on the current focused element was not invalid as per our requirement we will stop calling the hiding of the xEditable block as of now , that's what i did implemented in above code block

Note: i don't want to allow hide() method gets triggered with out proper flow verifications

ckosloski commented 4 years ago

It sounds like you need to set blur = cancel

satyanarayanaAmzur commented 4 years ago

No bro ,i need blur and cancel but it won't skips the validation process as we know in professional development how important is valid data and validation process ,the issue was because of the HIDE() method was keep calling without checking the situation of the validation i, i felt it would need an update like "validatorEnable" flag for making it stop triggering irrespective of the validation,hope i do provided my situation/issue here,i;m sorry i'm unable to provide you jsfiddle related link as i'm less sound in JSFiddle consuming ,i will try my best provide you working code base soon

ckosloski commented 4 years ago

You want to force the user to enter valid data without being able to cancel entry? Can't you just then use blur=submit and remove the display of the buttons?