/*
 * Author       : pageantcast
 * Generated on : 23-Nov-2009 00:32:03
 * Version      : 3.0
 */
application "Contests"
{
    type = public
    date format = "dd-MMM-yyyy"
    time zone = "America/Chicago"
    section Home
    {
        form  Contests
        {
            displayname  =  "Contests!"
            captcha = true
            success message  =  "Thanks for your entry!"
            
            must  have  First_Name
            (
                displayname  =  "First Name"
                type  =  text
            )

            must  have  Last_Name
            (
                displayname  =  "Last Name"
                type  =  text
            )

            must  have  Gender
            (
                type  =  radiobuttons
                values  =  {"Male",   "Female"}
            )

            must  have  Contact_Address
            (
                displayname  =  "Contact Address"
                type  =  textarea
            )

            must  have  City
            (
                type  =  text
            )

            State
            (
                type  =  text
            )

            Zip_Code
            (
                displayname  =  "Zip Code"
                type  =  text
            )

            must  have  Email_Id
            (
                displayname  =  "Email"
                type  =  email
            )

            Webpage
            (
                displayname  =  "How did you find out about us?"
                type  =  picklist
                values  =  {"Friend",   "Facebook",   "MySpace",   "Website",   "Podcast Search",   "General Search",   "Other"}
                sortorder  =  ascending
            )

            actions
            {
                on add
                {
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                        on success
                        {
                            sendmail
                            (
                                To       :  "pageantcast@gmail.com" 
                                From     :  zoho.adminuserid 
                                Subject  :  "Got a contest entry" 
                                Message  :  input.formdata 
                            )
                        }
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

        list  Contests_View
        {
            displayname = "Contests! View"
            show  all  rows  from  Contests 
            (
                ID
                Added_User as "Added User"
                Added_Time as "Added Time"
                Modified_User as "Last Modified User"
                Modified_Time as "Last Modified Time"
                First_Name as "First Name"
                Last_Name as "Last Name"
                Gender
                Contact_Address as "Contact Address"
                Email_Id as "EmailId"
                Webpage as "Find Us?"
                City
                State
                Zip_Code as "Zip Code"
            )
            options
            (
                display rows = 100
            )
        }

    }

}
