/*
 * Author       : zchelp
 * Generated on : 23-Nov-2009 01:44:11
 * Version      : 3.0
 */
application "NumericCheckbox"
{
    type = public
    date format = "dd-MMM-yyyy"
    time zone = "America/Los_Angeles"
    section Home
    {
        form  Form1
        {
            
            column
            {
                Are_you_single
                (
                    displayname  =  "Are you single?"
                    type  =  radiobuttons
                    values  =  {"Yes",   "No"}
                    on user input
                    {
                        if (input.Are_you_single  ==  "Yes")
                        {
                            input.Points = 2;
                        }
                        else if (input.Are_you_single  ==  "No")
                        {
                            input.Points = 1;
                        }
                    }
                )

                Have_kids
                (
                    displayname  =  "Have kids?"
                    type  =  radiobuttons
                    values  =  {"Yes",   "No"}
                    on user input
                    {
                        if (input.Have_kids  ==  "Yes")
                        {
                            input.Points1 = 1;
                        }
                        else if (input.Have_kids  ==  "No")
                        {
                            input.Points1 = 2;
                        }
                    }
                )

            }
            column
            {
                Points
                (
                    type  =  number
                    width  =  20
                )

                Points1
                (
                    type  =  number
                    width  =  20
                )

                TotalPoints
                (
                    type  =  formula
                    value  =  (Points  +  Points1)
                )

            }
            actions
            {
                on add
                {
                    on load
                    {
                        hide Points;
                        hide Points1;
                    }
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

        list  Form1_View
        {
            displayname = "Form1 View"
            show  all  rows  from  Form1 
            (
                Are_you_single as "Are you single?"
                Have_kids as "Have kids?"
                TotalPoints
            )
            filters 
            (
                Are_you_single
                Have_kids
            )
            options
            (
                display rows = 100
            )
        }

    }

}
