FP98: ActiveX 2.0 Form Controls Values Not Sent to Save Results Bot (200689)



The information in this article applies to:

  • Microsoft FrontPage 98 for Windows

This article was previously published under Q200689

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::
  1. On the Insert menu, point to Form Field, then click Push Button.
  2. Right-click the button, and click Form Field Properties.
  3. Change the Button Type to "Submit" and clear the Name box.
  4. Click Form.
  5. Type Form1 in the Form Name box.
  6. Click Advanced.
  7. Click Add.
  8. Type CheckBox1Value as a name, and select "Not Checked" as a value.
  9. Click OK.
  10. Repeat steps seven to nine to create a hidden field named CheckBox2Value.
  11. 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:
  1. On the Insert menu, and point to Advanced, then click ActiveX Control.
  2. In the Pick a Control list, click to select Microsoft Forms 2.0 CheckBox.
  3. In the Name box, type CheckBox1.
  4. Click Properties.
  5. Click the Caption box.
  6. Type Selection 1 in the field at the top of the dialog box.
  7. Click Apply, then click OK on the Edit ActiveX Control dialog box.
  8. Click OK to exit the ActiveX Control Properties dialog box.
  9. 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:
  1. On the Insert menu, point to Advanced, and then click Script.
  2. Click to select the JavaScript option to choose it as the Language.
  3. 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"
    
    }
  4. Click OK.
Fourth, insert a Javascript function that activates the UpdateFormFields() function when Submit is clicked. To do this, follow these steps:
  1. On the Insert menu, point to Advanced, and then click Script.
  2. Click to select JavaScript as the Language.
  3. Click Script Wizard.
  4. Click to select Code view at the end of the Script Wizard dialog box.
  5. In the Select an Event window, click the plus sign to expand the Form1 section
  6. Click to select the "onSubmit" event.
  7. Type the following into the script window:
    UpdateFormFields()
  8. 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.

Modification Type:MajorLast Reviewed:12/1/2000
Keywords:kbinfo kbusage KB200689