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:
- Create a new web form and in the code-behind of the web form, get an instance of the FormsManager.
- Using the web form's name, get the web form that requires responses.
- Create a new form entry of type FormEntry.
- Set the value of the textbox, the IP address, the time when the response is submitted, and user ID.
- If you use multilingual environment, set the language of the entry.
- To increase the form entry seed and set the referral code.
- Call the SaveChanges method to preserve the changes to the database.
The following code illustrates a implementation of the web form's code-behind: