Populate Page Form Selection from Page Datasource

Is it possible to use the a data source via script/api on a page to populate that page’s form. Example: I want a script/api to produce a list on page-load that I can use in a form as a selection. Like, provide a list of users I can select in a dropdown list in the form. This option would be very useful in a lot of my forms. Thanks!