In this work, we extend the recently developed Molecular Theory of Weak Polyelectrolyte Gels to study hydrogel films. This approach explicitly accounts for all of the physicochemical interactions determining the thermodynamic equilibrium of these films and it incorporates molecular details of the polymer network. In particular, we applied this theoretical framework to investigate the response of a thin film of cross-linked hydrophilic polyacid chains to variations in external stimuli such as pH, salt concentration and applied electric potential. Swelling of the polyacid gel film is a continuous but sharp transition that occurs in a narrow range of bulk pH, around the pKa of the acid monomers. The width of this transition range depends on the salt concentration. The gel swells if the bulk pH is larger than the pKa of the monomers and it collapses otherwise. Swelling, however, is not due to a high degree of dissociation in the network, since the swollen gel can have very low degree of electric charge, but the result of the complex balance between the acid–base equilibrium, the gel molecular organization, and the resulting electrostatic interactions. The region close to the surface (up to a few nanometres-thick), the center of the gel, and the interface between the film and the solution have different chemical compositions, which are each different from that of the bulk solution in equilibrium with the film. In particular, the pH in all these regions can be controlled by changing the bulk pH and salt concentration. In addition, there is a gradient of pH going from the solution inside the film, whose magnitude can be tuned by varying bulk pH and salt concentration. In the region near the surface, both the pH and total charge density can be controlled by applying an electric potential. The thin film behaves as an electric insulating material. We calculated the potential of mean force for the insertion of charged nanoparticles inside the hydrogel film. Depending on the electric charge and size of the nanoparticle, there can be an attractive well or a repulsive barrier of several kBT for the nanoparticle to enter the gel from the solution. These findings are relevant in the design of a variety of functional devices using hydrogel films.