Thursday, October 16, 2008

DB/TextWorks: simple Form Script to populate field with user name

The script below puts the user's Windows login name in a specific form box when the user creates a New Record using the edit form containing the script.

function onRecordNew()
{
var WSHNetwork = new ActiveXObject("WScript.Network");
var szLoginName = WSHNetwork.UserName;
Form.boxes("boxEnteredBy").content = szLoginName;
}

The only other step is to ensure that you call the box you want populated with the user's login name "boxEnteredBy" on the Names tab of the Form Script dialog box.

This script requires that Windows Script Host be installed on the user's machine.

You can also have a substitution list on the field that transforms the login name to a prettier form of the name.

E.g., a subtitution list entry might look like:

lweiss:Lisa Weiss

Thursday, October 2, 2008

WebPublisher PRO: New Search shows query criteria

Question: If I click the New Search button on the search results page, when I return to the query screen, my previous query criteria still appear. How do I eliminate this behavior so the query boxes are empty when I click New Search?

Answer: Edit the HTML query screen and remove the following line:

<input id="QS" type="hidden" value="query screen name" name="QS">