To be sure what does the processing of the click, put a message or something else that gives you a sign "Hey here we are!", immediatly after the "IF".
Normally, all the "IF" branches should work in this code. So i suspect there is another thing what leads you to think a branch doesn't work.