Helper Methods

Note: Current version does not support the full Wufoo API.

void EmbedForm ()
  Shows an embedded Wufoo form on your page. Once on your site, everything related to the form will work: validation will occur,confirmation emails will be sent, and the data will be sent to your Wufoo account.
void GetWebHookData ([bool handshakeValidation])
  Stores all the structure and values submitted by the form in the Fields collection. Each field is identified by its internal ID. Additionally, the method defines custom properties based on each field type.
The parameter indicates if the method has to perform the handshake validation against the initialized form keys.
void Initialize (string apiKey, string subdomain)
  Initializes the helper with the Wufoo application key and the subdomain.
void AddHandshakeKey (string hash, string key)
  Adds a handshake key to the dictionary, indexed by form hash.
bool ExistsHandshakeKey (string hash, string key)
  Validates if the given handshake key exists in the keys collection for the given hash form. 

 

WebHook Helper Reference

After executing Wufoo.GetWebHookData() method to collect the form fields, you can access a collection of items with the following properties:

Fields Dictionary with the fields content, indexed by the internal ID
FormStructure Dynamic collection with Wufoo form post data
HandshakeKey Form security identifier
Ip Source IP
CreatedBy Creator name
DateCreated Creation date
EntryId Wufoo internal ID

 

var formData = Wufoo.GetWebHookData();
var ip = formData.Ip;
var date = formData.DateCreated;
...
var fieldValue = formData.Fields["{field-id}"].Value


 

FormStructure Collection Properties

DateCreated
DateUpdated
Email
EndDate
EntryLimit
Hash
IsPublic
Language
Name
RedirectMessage
StartDate
Url

 

var formData = Wufoo.GetWebHookData();
var formHash = formData.FormStructure.Hash;
var language = formData.FormStructure.Language;

 

Field Collection Properties

Standard Fields

Fancy pant fields

 

Single Line Text A single line text.
Properties
Value Value of the field
ID Wufoo internal ID of the field
Title Title of the field in the form
Type Wufoo internal type of the field
IsRequired Wufoo internal value that indicates if the field is required (1) or not (0)
Screenshot
Usage
data.Fields["{fieldID }"].Value //The value of the text. 
  Back
Number A single line numeric field. Provides numeric validation.
Properties
Value Value of the field
ID Wufoo internal ID of the field
Title Title of the field in the form
Type Wufoo internal type of the field
IsRequired Wufoo internal value that indicates if the field is required (1) or not (0)
Screenshot
Usage
data.Fields["{fieldID }"].Value //The value of the number. 
  Back
Paragraph Text A multiple line text block.
Properties
Value Value of the field
ID Wufoo internal ID of the field
Title Title of the field in the form
Type Wufoo internal type of the field
IsRequired Wufoo internal value that indicates if the field is required (1) or not (0)
Screenshot
Usage
data.Fields["{fieldID }"].Value //The value of the paragaph text. 
  Back
Dropdown A dropdown list that allows a single element selection.
Properties
Value Label of the selected element
Choices Dynamic list of the dropdown elements. Each element has the Label propery
ID Wufoo internal ID of the field
Title Title of the field in the form
Type Wufoo internal type of the field
IsRequired Wufoo internal value that indicates if the field is required (1) or not (0)
Screenshot
Usage
data.Fields["{fieldID }"].Value //Selected item value
foreach(dynamic element in data.Fields["{fieldID }"].Choices){
    @element.Label  //renders the label element
}
                    
  Back
Multiple Choice A set of option buttons. Allows a single option selection
Properties
Value Label of the selected element
Choices Dynamic list of the dropdown elements. Each element has the Label propery
ID Wufoo internal ID of the field
Title Title of the field in the form
Type Wufoo internal type of the field
IsRequired Wufoo internal value that indicates if the field is required (1) or not (0)
Screenshot
Usage
data.Fields["{fieldID }"].Value //Selected item value
..
foreach(dynamic element in data.Fields["{fieldID }"].Choices){
    @element.Label  //renders the label element
}
                    
  Back
Checkboxes A group of checkboxes. Allows multiple selection.
Properties
SelectedValues Dynamic list of the selected values labels
Value All the selected values, separated by pipes '|'
SubFields Dynamic list of all the options. Each element of the list has an ID and a Label property
ID Wufoo internal ID of the field
Title Title of the field in the form
Type Wufoo internal type of the field
IsRequired Wufoo internal value that indicates if the field is required (1) or not (0)
Screenshot
Usage
//Renders the value of the all the selected items: "Choice1|Choice3".
    data.Fields["{fieldID }"].Value 

foreach(var option in data.Fields["{fieldID }"].SelectedValues){
    @option.ToString(); //Shows the selected values
}
..
foreach(dynamic element in data.Fields["{fieldID }"].SubFields){
    var elementID = element.ID;
    var elementLabel = element.Label;
    @elementID  //ex: Form110
    @elementLabel //ex: "I accept the terms"
} 
  Back
Name A line text block separated in 'Name' and 'Last Name' text fields.
Properties
Name Value of the name
Last Name Value of the last name
Value Value of the name followed by the last name (Ex: John Smith)
ID Wufoo internal ID of the field
Title Title of the field in the form
Type Wufoo internal type of the field
IsRequired Wufoo internal value that indicates if the field is required (1) or not (0)
Screenshot
Usage
var person = data.Fields["{fieldID }"].Value //John Smith
var name = data.Fields["{fieldID }"].Name;
var lastName = data.Fields["{fieldID }"].LastName; // Smith  
  Back
Address A multiple field text block for the address, separating the street, city, state and the country.
Properties
Street Street
Address Address line 2 for additional data
City City name
State State name
Zip Zip code
Country Country
Value Address properties separated by commas ','
ID Wufoo internal ID of the field
Title Title of the field in the form
Type Wufoo internal type of the field
IsRequired Wufoo internal value that indicates if the field is required (1) or not (0)
Screenshot
Usage
var street = data.Fields["{fieldID }"].Street;
var country = data.Fields["{fieldID }"].Country;
...
var fullAddress = data.Fields["{fieldID }"].Value 
                    
  Back
Phone A single line text block for phone entry.
Properties
Value Value of the field
ID Wufoo internal ID of the field
Title Title of the field in the form
Type Wufoo internal type of the field
IsRequired Wufoo internal value that indicates if the field is required (1) or not (0)
Screenshot
Usage
data.Fields["{fieldID }"].Value //The value of the text. 
  Back
Email A single line text block for email entry, which also validates the input.
Properties
Value Value of the field
ID Wufoo internal ID of the field
Title Title of the field in the form
Type Wufoo internal type of the field
IsRequired Wufoo internal value that indicates if the field is required (1) or not (0)
Screenshot
Usage
data.Fields["{fieldID }"].Value //The value of the text. 
  Back
Web Site  A single line text block for Web site URL entry
Properties
Value Value of the field
ID Wufoo internal ID of the field
Title Title of the field in the form
Type Wufoo internal type of the field
IsRequired Wufoo internal value that indicates if the field is required (1) or not (0)
Screenshot
Usage
data.Fields["{fieldID }"].Value //The value of the text. 
  Back
Price A single line text block for price entry, with a field for the cents.
Properties
Value Value of the field
ID Wufoo internal ID of the field
title Title of the field in the form
type Wufoo internal type of the field
IsRequired Wufoo internal value that indicates if the field is required (1) or not (0)
Screenshot
Usage
data.Fields["{fieldID }"].Value //The value of the text. 
  Back
Date A single line text block for date entry.
Properties
Value Value of the field
ID Wufoo internal ID of the field
Title Title of the field in the form
Type Wufoo internal type of the field
IsRequired Wufoo internal value that indicates if the field is required (1) or not (0)
Screenshot
Usage
data.Fields["{fieldID }"].Value //The value of the text. 
  Back
Time A single line text block for time entry.
Properties
Value Value of the field
ID Wufoo internal ID of the field
Title Title of the field in the form
Type Wufoo internal type of the field
IsRequired Wufoo internal value that indicates if the field is required (1) or not (0)
Screenshot
Usage
data.Fields["{fieldID }"].Value //The value of the text. 
  Back
Likert: Like Relationship Table A voting grid which has statements in the rows, and choices to vote in the columns.
Properties
SubFields Dynamic list of all the statements. Each element contains the Value, ID, and Label properties
Choices Dynamic list of the column elements. Each element contains the Label and Score properties
Value Selected choice of the first statement
ID Wufoo internal ID of the field
Title Title of the field in the form
Type Wufoo internal type of the field
IsRequired Wufoo internal value that indicates if the field is required (1) or not (0)
Screenshot
Usage
foreach(dynamic statement in data.Fields["{fieldID }"].SubFields){ 
    selectedChoice = statement.Value;
    selectedChoiceID= statement.ID;
    ...
}
var firstChoiceScore = data.Fields["{fieldID }"].Choices[0].Score;
  Back
File Upload Uploads a local file to a public address managed by Wufoo, and retrieves its name and download URL.
Properties
AttachName File name
AttachURL File download URL
Value Value of the file name
ID Wufoo internal ID of the field
Title Title of the field in the form
Type Wufoo internal type of the field
IsRequired Wufoo internal value that indicates if the field is required (1) or not (0)
Screenshot
Usage
var fileName = data.Fields["{fieldID }"].AttachName;
var fileDownloadURL = data.Fields["{fieldID }"].AttachURL;
...
data.Fields["{fieldID }"].Value //The value of the attach name. 
  Back

Last edited Jan 11, 2011 at 1:31 PM by jsenior, version 18

Comments

No comments yet.