Counterexample to "if $f:A\to A$ induces the identity $\hat f:\operatorname{Spec}(A)\to\operatorname{Spec}(A)$, then $f=\operatorname{id}_A$" Does anyone know any example that invalidates the following affirmation:

If a morphism $f:A\to A$ induces the identity $\hat f:\operatorname{Spec} \left( A \right) \to \operatorname{Spec} \left( A \right)$ then $f = \operatorname{id} _A $.

 A: Let us recall that the category of affine schemes is equivalent to the category of commutative rings (with unit). In particular we have a bijection of sets
$$\mbox{Hom}_{\mathfrak{Rings}}(A,B) \leftrightarrow \mbox{Hom}_{\mathfrak{ScH}}(\mbox{Spec}(B),\mbox{Spec}(A)).$$
defined as follows. For any $\varphi : \mbox{Spec}(B) \to \mbox{Spec}(A)$ we have an associated map on sheaves $\varphi^{\sharp} : \mathcal{O}_{\mbox{Spec}(A)} \to \varphi_\ast \mathcal{O}_{\mbox{Spec}(B)}$. Taking global sections we obtain a ring homomorphism $A \to B$. Now consider the case $A = B$. Because the the identity map $f : A \to A$ induces the identity map on $\mbox{Spec}(A)$, then whatever map that induces the identity on the spectra has to be the identity (by injectivity of the correspondence above).
Edit: I should clarify that in my answer above I am treating $\operatorname{Spec} A$ as an affine scheme with its structure sheaf and not just as a topological space. In the latter case my answer will not be true anymore; take $A = k(x)$ that has automorphism group $\mbox{PGL}(2)$.
A: The question is ambiguous.  Do you mean to assume that $\hat{f}$ is the identity on the topological space $\operatorname{Spec}(A)$ or on the scheme (or ringed space) $\operatorname{Spec}(A)$?  If the former, then any non-identity automorphism of a field provides a counterexample.  If the latter, BenjaLim's answer applies.
