dominoGuru.com
Your Development & Design Resource
Quicktip/Hack: Domino URL Commands via Hidden Fields
08/05/2008 03:58 PM by Chris Toohey
Author's Note: This is a real quicktip here - something that will help you when either rolling your own markup in Domino or trying to integrate a non-Domino HTTP Server solution with your Domino Web Application. It's kind of a hack, I'll admit, but I've found it pretty useful over the years.
Let's say you're in a situation where you need to communicate with a Domino Design Element from a simple HTML form... written in Dreamweaver, TopStyle, or any other markup editor, and you want to use the GET method, as the URL could be copied and sent to other users. Such a GET-friendly URL would look something like this:
http://server/database/Design+Element?DominoURLcommand¶meter1=val1&p
arameter2=val2
The problem with Domino, the DominoURLcommand
is
required, lest you want your Domino application to barf when you click on the
URL. If you have a simple HTML form that's using the GET method, you're going
to run into this problem.
The solution? A simple hidden input at the top of your form:
<form action="agentname" method="get" name="sample" id="sample">
&nbp;<input type="hidden" name="openagent" value="" />
&nbp;<label for="foo" id="label_foo">Foo:</label>
&nbp;<input type="text" name="foo" id="foo" value="" />
&nbp;<input type="submit" value="Submit" />
</form>
Now, when submitted, the GET method basically grabs all of the "field" objects and their values and builds a URL. For the above example, you'll get the following:
http://server/database/agentname?openagent=&foo=bar
And this actually works! ;-)
From here, you can now take any Domino URL Command, and simply create a hidden input object that has no value but that shares it's name: CreateDocument, SaveDocument, DeleteDocument, OpenView... the list goes on and on!