Adding Elements To An ASPForm Object

The ASPForm class is not very useful by itself, and an example showing the utility of the component at this point would be rather pointless so we are going to add a few elements and then return to the details of the ASPForm class. We'll create a few elements that we can use for the next few examples.

Example 2.2. Adding Elements To An ASPForm Object

	'create an ASPForms object
	set hASPForm = Server.CreateObject("ASPForms.ASPFormV1")
	
	'create a name element in the form
	hASPForm.Elements.CreateElement "name", true
	
	'create an address1 element in the form
	hASPForm.Elements.CreateElement "address1", true
		
	'create an address2 element in the form
	hASPForm.Elements.CreateElement "address2", false
	
	'create a city element in the form
	hASPForm.Elements.CreateElement "city", true				
	
	'create a state element in the form
	hASPForm.Elements.CreateElement "state", true				
	
	'create a zipcode element in the form				
	hASPForm.Elements.CreateElement "zipcode", true
	
	'store the form's state and configuration into the session
	hASPForm.StoreStateInSession "addressInfo"