What I like about being a web developer is the constant need to learn. If I were to move away from Domino, one of the driving factors would be the feeling that I've learnt everything there is to know. It gets boring for me once I'm no longer learning new things. Although, that said, every now and then, I surprise myself and learn some simple new trick that's evaded me for years. Domino never stops surprising me in that way.
A normal submit button created by Domino looks like this:
<input type="submit" value="Save">
Notice it has no name attribute! This is why it doesn't get sent to the server with the other fields. But, you can create your own buttons that do have names, like this:
<input type="submit" name="Action" value="Approve" /> <input type="submit" name="Action" value="Reject" />
Depending on which of these is pressed the browser will send its name and value to the server. Say we press the Approve button it would POST the following information to the server:
This is exactly the same information that would have been sent if we had the following normal field on the form:
<input type="text" name="Action" value="Approve" />
Jeff suggested that we could work out which button was pressed by examing the Request_Content field using LotusScript. Thankfully, this isn't necessary. We don't need any script at all. Because the button is submitted just like a normal field, that's all we need, a normal field on the form with the same name as the button. In the above case we'd add a field called Action and this would have a value of either Approve or Reject, depending on which button was pressed. This field can be accessed by any WQS agent and the logic for processing the form can use its value. Magic!
I plan on extending this demo with more in-depth examples of this technique, as well as showing other ways of making Domino sites accessible to all. You might not appreciate it, but accessibility will become increasingly important in the future. Rather than a passing fad it's a law.
Is this yet another hack? I don't think so. If it is a hack, it's an elegant hack. I'm fussy about what hacks I use and I'd have no qualms with using this one. All I've done is over-ride Domino's default button. Is it such a hack that I should think about whether to use Domino in the first place (as a couple of you suggested yesterday)? Not at all! I'm still using every other facet of Domino, just not its HTML.