4

My question is related to set focus on ace editor

This time I want to delete the content whenever there is a validation error.

I have the used the pattern like

/^[0-4]$/ and /^([1-9][0-9]{0,3}|[1-5][0-9]{4}|60000)$/;

to check the value between 0-4 and 1-60000 respectively. When user provides invalid data my text area is cleared but not the ace editor. I also tried

    $scope.close = function () {
rowObj.entity.value = editor.getValue();
            editor.setValue("",0);
                };

but that is not working.

Community
  • 1
  • 1
Sudip7
  • 2,384
  • 3
  • 27
  • 35
  • Why don't you just do an `editer.setValue("",0)`? – JoseM Mar 27 '14 at 13:35
  • but I need to delete the content in case if there is a validation error in the textarea, how to do that, is there any event occurs during validation error which I can use to delete the content of ace editor – Sudip7 Mar 28 '14 at 04:15
  • I modify the code but still not working, I don't know how to sync the state of textarea with the ace editor, is there any event – Sudip7 Mar 28 '14 at 07:13
  • when I am using my solution(as described above) m not able to clear the editor. but when I am doing the reverse `editor.setValue("",0); rowObj.entity.value = editor.getValue();` I am able to do so. Actually I am checking certain condition before executing the second solution. I just want to know what is the impact of validation error message(the message displayed when a value is not allowed in a particular field) in angularjs. Is there any exception or error occurs or it is just cosmatic @JoseM – Sudip7 Apr 01 '14 at 05:03

1 Answers1

8

to clear editor simply call editor.setValue("")

a user
  • 23,300
  • 6
  • 58
  • 90