AddFormElement Method

 Object: XFRequest
 Syntax: AddFormElement Name As String, Value As String
 Description: This method adds a form element to the request. AddFormElement takes two parameters:
  • Name As String
    Name of the form field

  • Value As String
    Value of the form field


The XFRequest object does not automatically add form elements to the request. In order to pass form values from the file transfer page to the server, they must be added to the XFRequest object using the AddFormElement method. This includes the hidden _VIEWSTATE property, which is used to preserve viewstate in ASP.NET.
 Example:
        
Set SAXFile = Server.CreateObject("SoftArtisans.XFRequest") 
SAXFile.Server = "localhost"
SAXFile.ObjectName = "/SAXFileSamples/ASP/post/formdata/formresp.asp" 

'--- Add form elements to the transfer with name/value pairs 
'--- Turn off Anonymous user access to get a value for this Server Variable
SAXFile.AddFormElement "UserName", Request.ServerVariables("LOGON_USER")
SAXFile.AddFormElement "URL", Request.ServerVariables("HTTP_REFERER") 
SAXFile.AddFormElement "DateTime", Now() 

'--- Begin transfering the form data SAXFile.Start 
'--- Write the response from the transfer (results from object name ASP file) 
Response.Write SAXFile.Response 
      

Copyright © 2010 SoftArtisans, Inc. All rights reserved.