I am currently using FormFactory (http://formfactory.apphb.com/) to dynamically generate forms for me. This generally works well except for when rending my custom field types which require certain JavaScript files.
What I would like to do is dynamically add JavaScript references to the page depending on what Editor templates have been rendered by FormFactory.
At the moment I am having to reference all JavaScript libraries regardless of whether they are being used. Is there a better way of doing this to ensure that I don't reference libraries which aren't being used?
Edit: Yes, I could add the reference into the EditorFor template, however this would duplicate references if the same template is used more than once.
Thanks