I have a panel form in ExtJS and a textfield inside and I am trying to insert a . symbol before * in this textfield. I have a button that sends the value from this textfield to a server and returns me results.
In my code, I check if a string contains a * symbol, then I insert the . from this textfield into it.
Example of what I have now: I type in textfield *test* my code convert it to *test.*. What I need is .*test.*.
If I type in textfield *t*st* I need the .*t.*st.* as a result.
How I can insert the . symbol before every * symbol in my value string?
fieldLabel: 'name',
name: 'name',
submitValue: true,
enableKeyEvents: true,
getSubmitValue: function () {
var value = this.getValue();
var format = /[*]+/;
let valTrimmed = value.slice(0, value.length -1);
var ts = '';
if(format.test(value)){
ts = valTrimmed + '.*';
return ts;
}
return value;
}