A search for a charged Higgs boson is presented in the process for charged Higgs boson mass lighter than the mass difference of the top and bottom quarks and in the and processes for charged Higgs boson mass heavier than the mass difference of the top and bottom quarks. The analysis concentrates on the decay mode in a fully hadronic final state. The analysed data were recorded by the CMS experiment in 2012 at a centre-of-mass energy of 8~TeV at the CERN LHC and correspond to an integrated luminosity of 19.7~fb. The transverse mass of the tau and missing transverse energy system is exploited for separating the potential signal from the expected backgrounds. The mass spectrum observed in data is in agreement with the standard model prediction. Model-independent 95\% confidence-level upper limits calculated with the modified frequentist criterion are established as 1.2--0.16\% on for in the range of 80 to 160~GeV and 0.38--0.026~pb on for in the range of 180 to 600~GeV.