FP98: ActiveX 2.0 Form Controls Values Not Sent to Save Results Bot
ID: Q200689
|
The information in this article applies to:
-
Microsoft FrontPage 98 for Windows, version 98
SUMMARY
When you use ActiveX 2.0 form controls on a form that uses a
Save Results component, the values from the ActiveX controls are not saved with the form results.
MORE INFORMATION
The ActiveX form controls do not communicate directly to the ISAPI or CGI-based save-results component. A small amount of scripting and some hidden fields are required. The following code examples will show you how this is accomplished in FrontPage Editor.
First, insert a form with two hidden fields. To do this, follow these steps::
- On the Insert menu, point to Form Field, then click Push Button.
- Right-click the button, and click Form Field Properties.
- Change the Button Type to "Submit" and clear the Name box.
- Click Form.
- Type Form1 in the Form Name box.
- Click Advanced.
- Click Add.
- Type CheckBox1Value as a name, and select "Not Checked" as a value.
- Click OK.
- Repeat steps seven to nine to create a hidden field named CheckBox2Value.
- Click OK to all dialog boxes until you return to FrontPage Editor.
Second, Insert two ActiveX check box controls. To do this, follow these steps:
- On the Insert menu, and point to Advanced, then click ActiveX Control.
- In the Pick a Control list, click to select Microsoft Forms 2.0 CheckBox.
- In the Name box, type CheckBox1.
- Click Properties.
- Click the Caption box.
- Type Selection 1 in the field at the top of the dialog box.
- Click Apply, then click OK on the Edit ActiveX Control dialog box.
- Click OK to exit the ActiveX Control Properties dialog box.
- Repeat steps one through eight to insert another control named CheckBox2, with the caption Selection 2.
Third, insert a JavaScript function to populate the hidden fields in the form. To do this, follow these steps:
- On the Insert menu, point to Advanced, and then click Script.
- Click to select the JavaScript option to choose it as the Language.
- Type in the following function in the Script window:
function UpdateFormFields()
{
if (CheckBox1.value)
Form1.CheckBox1Value.value="Checked"
if (CheckBox2.value)
Form1.CheckBox2Value.value="Checked"
}
- Click OK.
Fourth, insert a Javascript function that activates the UpdateFormFields() function when Submit is clicked. To do this, follow these steps:
- On the Insert menu, point to Advanced, and then click Script.
- Click to select JavaScript as the Language.
- Click Script Wizard.
- Click to select Code view at the end of the Script Wizard dialog box.
- In the Select an Event window, click the plus sign to expand the Form1 section
- Click to select the "onSubmit" event.
- Type the following into the script window:
UpdateFormFields()
- Click OK.
Now when you click Submit, the UpdateFormFields() function will change the values of the CheckBox1Value and CheckBox2Value fields if the ActiveX controls are checked, and these values will be returned in the form's results.
Additional query words:
98, ActiveX, Scripting front page
Keywords : kbusage kbdta
Version : WINDOWS:98
Platform : WINDOWS
Issue type : kbinfo
Last Reviewed: July 7, 1999