A quick updates to an old database

Now don’t tell me off for this, and yes its very old and very dodgy, but this kind of thing seems to be creeping up more and more, so I figured it might be of use to someone

A client asked for a quick fix to a existing database, the problem being that a old Domino web database was causing problems, the code that runs when the button was clicked was taking longer and longer (growing data set) and the users were getting impatient and clicking the button multiple times causing the code to run multiple times, the client wanted the button to disable and show a little Ajax swirl when clicked , “no worries” i thought a simple little problem, then i find that this is an OLD db, the button was a actually a notes client button with formula under it on and form that was not either xpages or HTML

So, i ended up wraping the button in a bit of HTML and JS

and changing the ID of the button

here is the code in copy and paste version

<span style="display:none;">**OldStyleButton**</span>
<input type="button" id="AcceptSch" value="Accept"
onclick="document.getElementById('AcceptSch').disabled = true;
document.getElementById('AcceptSchAjax').style.display = '';
<img id="AcceptSchAjax" src="/**PathToFile**/ajax-loader.gif"  width=16px height=16px style="display:none" />

Thankfully because the db was so old, there was no Ajax and a full page refresh is done on the page after the code under the button is complete, which meant i did not have to handle re enabling the button, simple

Now before you attack for the in line JS and no framework or stuff like that, there are reasons for this

– This database has had a lot of developers in its long life and I’m sure i wont be the last, this way might be a bit ugly but you can at least see the bloody thing, I hate bug fixing a database and touching something that breaks a dozen things that you cant see. and dont want to make it worse for the next dev
– Its simple and only changes one design element
– It works

ah well hope its useful, now time to leave the 00’s, and get back to modern problems.

Leave a Reply

Your email address will not be published.