As far as I know, this cannot be done using the on() function. However, when solving a linear system, Ax=b you can always lock a DOF to a value by setting a row of the matrix A to all zeros except for a one at the point corresponding your DOF of interest. Then set the corresponding DOF in b to the desired value of the Dirichlet condition.