On Palais' principle for nonsmooth functionals