My DS has always been extremely sensitive and relatively cautious but generally very happy and easy going. Recently at school teachers have noticed a change in his attitude, he has stopped contributing in class and doesn't complete exercises set by them, and got stroppy if they have told him off (not shouting)about something which is unusual for him as he normally loves school and mostly still does from what I can tell. I've noticed a lack of confidence and when I asked about his behviour at school he says he doesn't try because his work is rubbish and that he's rubbish etc. He is more aware that he struggles with writing compared to other kids. I don't know where this has come from and teacher's are none the wiser but something has obviously happened to trigger this change. When I try and give him encouragement and praise he used to take it but now he just says it's not true 
At home he has been regressing toilet wise and pooing in his pants and often is lost in his own world. He doesn't always respond to what DH or I ask him to do or make any effort to go to the toilet. I am starting to lose my patience with the toilet thing and don't know what to do.
I know I have to keep positive but I don't know why this is happening or what to do about it, please help