Add object id to html id

Otherwise dojo will give errors about conflicting id
in situations where you have multiple open forms (eg in tabs)
Switch dojo props from json to js and more

Major code refactoring.
Can now use more advanced dojo functions which can only
be expressed in js, such as the QueryReadStore support
for FilteringSelect, also implemented in this commit