likemike Posted January 9, 2022 Share Posted January 9, 2022 Hello! I need some JS-scripts to address a UnimMemo. I use Form->Script: Ext.form.TextArea.prototype.deleteAtCursor = function(txt) { var val = this.getValue(), start = this.inputElement.dom.selectionStart, end = this.inputElement.dom.selectionEnd; this.setValue(val.substring(0, start - 1) + val.substring(end)); this.inputElement.dom.selectionStart = this.inputElement.dom.selectionEnd = start - 1; Ext.defer(function() { this.focus(false); }, 10); } to do a backspace and it works! I use Form->Script: Ext.form.TextArea.prototype.insertAtCursor = function(txt) { var val = this.getValue(), start = this.inputElement.dom.selectionStart, end = this.inputElement.dom.selectionEnd; this.setValue(val.substring(0, start) + txt + val.substring(end)); this.inputElement.dom.selectionStart = this.inputElement.dom.selectionEnd = start + txt.length; Ext.defer(function() { this.focus(false); }, 10); } to insert text and it works, too! But when I put both together in Form->Script, then an error occurs saying: "Ajax Error: unexpected identifier!" Isn't it allowed to have more than one function in a script? Or is there a special syntax necessary? I know, that these problems are based on my lack of understanding Sancha and JS, so it's very frustrating to have to ask every time things, that normally could be done on my own. Thanks in advance Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 9, 2022 Share Posted January 9, 2022 Separate them with ; Quote Link to comment Share on other sites More sharing options...
likemike Posted January 9, 2022 Author Share Posted January 9, 2022 OMG! So easy. Thank U!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.