Create form responses

You can create multiple responses for a specific web form to analyze web form analytics and to monitor web form metrics, for example. You can create the required number of form responses all at once in the web form's code-behind.

PREREQUISITES: You created a web form with name testform1, for example, and dragged into the content of the form a textbox with label FirstName, for example. For more information about creating forms programmatically, see For developers: Create forms.

To create form responses:

  1. Create a new web form and in the code-behind of the web form, get an instance of the FormsManager.
  2. Using the web form's name, get the web form that requires responses.
  3. Create a new form entry of type FormEntry.
  4. Set the value of the textbox, the IP address, the time when the response is submitted, and user ID.
  5. Set the language of the entry.
  6. To increase the form entry seed and set the referral code.
  7. Call the SaveChanges method to preserve the changes to the database.

The following code illustrates a implementation of the web form's code-behind:

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?

Next article

Query form responses