Hi,
I'm trying to use the ClientSideOnNodeRename client script function to modify the text that the user has write (to format it, like "cod-text" should be changed to "cod - text", and things like this one)
But I've been unable to make it work properly. I've tryed several aproaches:
· Change the newText parameter value and make the function to return true: With this code the edit textbox dissapears with the edited node text. If I start to edit another tree node then the first node will reapear but with the original text.
· Change newText and return false. Then the user text is set correctly to the node text, without taking into account my changes.
· use node.setText() function to change the node text and return false: then I get a javascript error message (something like "argument not valid" -it's translated from spanish so maybe the english message is not exactly like that).
· use node.setText() and return true. Then I get the dissapearing text like in the second try, and I get the same javascript error when trying to edit another node.
My javascript node looks like this:
Code: JavaScript
function FormateaNombreNodo(treeview, node, newText)
{
var nodeKey = node.getValue().substr(0,1);
if (nodeKey==KEY_OP) {
var idx = newText.indexOf(SEP_COD_VALUE);
var code, name;
if (idx<0){
code = newText;
name = newText;
}
else {
code = newText.substr(0,idx);
if (idx==newText.length) name="";
else name = newText.substr(idx+1);
}
newText = code.toUpperCase() + " " + SEP_COD_VALUE + " " + name;
}
node.setText(newText);
return false;
}
(changing the last two lines depending on try case...)
Is there a way to accomplish this? is there a better way?
thanks in advance