Threshold conditions for electron trapping by nonlinear plasma waves