How to override cq default xtype "textfiled"
Hi All,
Our requirement is to "Encode" the Authored content in "textfiled" ,"pathfiled","textarea" before it got submitted to CQ-Server. For this we have overlayed "TextFiled.js" and Overidden method "syncValue()" in the Overlayed file. It is working fine in almost all places (Authored content is getting encoded and saved properly in CRX ). But in not working in some places. In "syncValue()" method we have written below code. We are not sure whether it is correct or not. We have copied and pasted this code from "RichText.js" file and made some minor modifications as per our requirement.
******************************************
syncValue: function() {
//var html = this.editorKernel.getProcessedHtml();
if(this.isFormField){
var html = this.getValue();
if(this.contentEncoding){
html=encodeURIComponent(html);
}
this.value=html;
if (this.fireEvent("beforesync", this, html) !== false) {
if(this.el.dom){this.el.dom.value = html;}
this.fireEvent("sync", this, html);
}
}
},
**************************************************************
Please let me know
1) Is it fine if we override "syncValue()" Method in overlayed "textfield.js" file? if so source code is correct or not? if not which method we need to override?
2) In some places for Path filed's it is giving below Java script error. What is the reason? But in Almost all places it is working fine (Encoding happening Properly).
if(this.el.dom){this.el.dom.value = html;} |
Note that:
We want do this using overlay concept only. Since we around 500+ text field's in our applications we do not want do this using Dialog listenrs. Also we do not want to do this using OSGI-java listenrs for other reasons.
Any Help or Pointers on this issue really appreciated.
Thanks
K Chaitanya