What i do is slice the onions then add the gram flour and leave in the fridge for 3 hours or overnight covered, the onions release their own moisture so a little water can be added. It seems that if your bhaji's are falling apart when in the oil, think it might be not having enough liquid in there, it needs to bind, then when the bhaji's are ready to make into balls. Take a handful of mixture shape into balls but don't press to hard. Then add to hot oil.