| 
	
	
		
		
		
		
		 >а что этот setForm делает? 
 
Forms and File Upload 
 
Connection Manager can automatically harvest HTML form data and prepare it for either a GET or POST request via the setForm method. When you call this method before initiating the transaction, Connection Manager constructs a GET querystring or a POST message from the form and submits it to the specified URL. To use this functionality, your form elements must have defined, non-empty string name attribute values. 
 
setForm will encode each HTML form field's name and value using encodeURIComponent. This results in a string of UTF-8 encoded, name-value pairs. NOTE: Setting an HTTP header of "Content-Type" with a different charset value will not change the encoding of the serialized data. 
 
If the subsequent asyncRequest is HTTP GET and has a URI querystring, the querystring resulting from setForm will be concatenated onto the URI's existing querystring. If the transaction is HTTP POST, and asyncRequest contains additional POST data -- as the fourth argument -- this data will be added to the form data to create the POST message. 
 
// argument formId can be the id or name attribute value of the 
// HTML form, or an HTML form object. 
var formObject = document.getElementById('aForm'); 
YAHOO.util.Connect.setForm(formObject); 
// This example facilitates a POST transaction.  The POST data(HTML form) 
// are initialized when calling setForm(), and it is automatically 
// included when calling asyncRequest. 
var cObj = YAHOO.util.Connect.asyncRequest('POST', 'http://www.yahoo.com', callback); 
  
 
setForm can also upload files, if form elements of input type="file" are present, as part of a form submission. To enable file uploading, set the second argument of setForm to true. When the transaction is complete, the callback object's upload method will be called. 
 
   // argument formId can be the id or name attribute value of the 
   // HTML form, or an HTML form object. 
   var formObject = document.getElementById('aForm'); 
  
   // the second argument is true to indicate file upload. 
   YAHOO.util.Connect.setForm(formObject, true); 
  
   var cObj = YAHOO.util.Connect.asyncRequest('POST', 'http://www.yahoo.com', callback); 
		
	
		
		
		
		
		
		
	
		
			
			
	
			
			
			
			
			
				 
			
			
			
			
			
			
				
			
			
			
		 
		
	
	
	 |