Domcfg, reasontype and onUnload

I am hoping someone can help me out here. We use the $$LoginUserForm provided by domcfg with a few minor tweaks. We enabled the JSHeader to force a “https” protocol switch if a user hits our site with “http” in their URL. If a password is entered incorrectly, then ReasonType gets updated and ReasonText notifies them of the error.

The problem is that we have now added code to the onUnload event to revert them back to http once they properly authenticate. We only want SSL enabled when a user is prompted for username and password, not when they are navigating our databases. The issue appears to be that once code is entered into the onUnload event, ReasonType and ReasonText no longer get updated. I understand why this is occuring, the onUnload is overiding the computation of other fields on the form.

The biggest problem is that this is an environment governed by FDA, CFR 21 Part 11. What this means is that when a user signs off an a document, their session is broken and they are forced to login (like an electronic signature). This happens in several places throught a documents workflow and we have a suite of over 30 databases. The onUnload event of the $$LoginUserForm is the only consistent place where we can control the protocol they use to access the site.

Any ideas on how to force an update of ReasonType when using onUnload? I have had no luck finding anyone else even using onUnload in $$LoginUserForm, so I don’t have much hope with this…especially since ReasonType seems to be an undocumented feature.

Any help or ideas are appreciated.