First off take a look at this thread on how to make your code look good here in the forum
I donāt know (yet) what the problem might be here but I have a suggestion that might resolve it anyway. Since the form is displayed on multiple pages with different templates I suppose you already have a snippet for the form that you include in each template. In this case you can consider putting the controller code of uniform(...)
directly in the snippet, too. Although this violates the āseparation of concernsā you donāt have to duplicate your code for each template and if it works on one page, it works on all pages.