Trying to understand open (closed) subfunctors

$G$ is an open subfunctor of $F = h_{\operatorname{Spec}(S)}$ means that for any $T,$ $G(T) = \operatorname{Hom}(\operatorname{Spec}(T), U)$ where $U\subseteq\operatorname{Spec}(S)$ is an open subscheme. Thus $\varphi\in G(T)$ implies that $\phi = \iota\circ\varphi\in F(T)$ where $\iota:U\hookrightarrow \operatorname{Spec}(S)$ is the inclusion, and there is an obvious bijective correpondence between such $T$-valued points of $\operatorname{Spec}(S)$ and $T$-valued point of $U.$

Thus, we simply need to realize that the condition "$\phi\in F(T)$ factors through $U$" is equivalent with the condition "$\phi^*(I)T = T,$ where $\phi^*:S\to T$ is the dual map, and $I$ is the ideal of the complement of $U.$"

For example, in the case $U = \operatorname{Spec}(S_f)$ for some $f\in S,$ we are asking that $\phi^*$ factors through $S_f$ which is equivalent to $\phi^*(f)\in T^\times$ is invertible. The complement of $U$ is $V(f),$ so what this boils down to is that $\phi^*(I)T = T,$ where $I=(f).$ I leave the general case to you.