Wednesday, October 19, 2005 4:53 PM
I was recently asked to develop an alternative to the WPP edit feedback page. The complaint was that it showed all the fields, could not be customized to suit the intranet template, and looked the same for all textbases. What would be nice, they said, is a different feedback page for each database, that didn't show all the fields, and that could have a completely customizable look. The file that all edits submit to, which performs all database interactivity and which acts as the feedback page, is /dbtw-wpd/asp/iwpp-edit.asp. It is a bad idea to mess with any file in the WebPublisher install directory which will be overwritten with each WPP upgrade, so I didn't want to touch it. I created a copy of it instead and moved it to an application subfolder, beneath the search page/new record page location: [application root]\EditHelper\iwpp-edit.asp. This makes it simple to keep track of and I don't disturb the original. I changed nothing in my new copy of iwpp-edit.asp except for the addition of a script block at the very end which redirects after database interaction, based on the name of the textbase being edited, and passes on any error message from the edit. For example, a textbase called "sales" would be redirected to [application root]\EditHelper\sales\EditSuccess.htm on a successful edit action. EditFailure.htm is similar but has some script that picks up the error msg from the query string and displays it on the page. The only addition to the edit forms was adding script to change the form action on page load. Instead of /dbtw-wpd/asp/iwpp-edit.asp, the edit form posts to EditHelper/iwpp-edit.asp. Since the dynamic edit form does not expose its body tag onload event, I attached an event listener from the script. The addition of a new textbase to this scheme is easy because redirection is based on textbase name. I just need to add a new folder under EditHelper which matches the name of the textbase, e.g. [application root]\EditHelper\catalog, and put a "catalog" version of EditSuccess.htm and EditFailure.htm in there. Easy peasy.