[javascript] fid form / onfailure behaviour
If onfailure is specified, it should be done _before_ any default /
standard CW action is done.
The callback signature should be the same as the onsuccess one.
If the onfailure callback returns true, the default actions will still
take place afterwards, otherwise (i.e. return false), the processing
stops directly after the callback.