Thanks denverh, I tried
that but couldn’t get it to work. Adding another
hidden user field to the form caused a save error unless I gave it storage, and
I didn’t want to do that.
I also tried bunch of
other things, but essentially came to the conclusion that conditional states
are really only useful for text / select fields and simple logic. Changing *to* a particular value is problematic for
example, because of various side effects trying to do it with multiple
conditions. Also the lack of load and
submit events is limiting. Finally the date
and user fields use multiple elements in the markup and these are not read or set
properly by the conditional events for the cases I tested.
A related issue is
this: http://www.seblod.com/resources/tracker/4813 making JS
functionality pretty limiting overall.
If anyone else is
interested this is what I ended up doing:
I wrote a javascript
function for the page and setup all the events myself. There were a number of places to store
this. Ideally, I’d like SEBLOD to
provide a page scoped field for JavaScript and CSS for both content types and
search lists. Unfortunately it does not. I’ve added a feature request here: https://github.com/Octopoos/SEBLOD/issues/36
In the end I
stored it in the field definition itself, along with an onChange attribute in
the same field definition to trigger it, and with code to detect if the related
fields were on the page before taking any action. Note that the code in the JS field executes
in the context of a document ready event, so you need to attach it to the
window object for your onChange attribute to find it.
Regards,
-dr