Save text in input field before clearing it (Bug?)

I want to give my string the value of a text inside an input field, but when I clear it, after giving my string the text value, my string gets the value of the clear instead. I did a test and changed the text to 0 instead of just clearing it, and my syncName string had the value of 0.

I want it to be like a chat, you write your message and when you press the button, it sends the text and clears the input field text.

(This is on a Network but I’m pretty sure it has nothing to do with the problem)

In FixedUpdate():
changeNameButton.onClick.AddListener (ChangeNameWithButton);

void ChangeNameWithButton(){
syncName = changeNameInputField.text.ToString();
CmdProvideNameToServer (syncName, syncIndex);
//changeNameInputField.text=“”;
}

I was retard a on click fonction on my button was calling too so it was calling twice.