////////////////////////////////////////////////////////////////////////
//
// Filename:    formparticiperen.js
// Purpose:     Create a form to submit participant info
// Method:      JavaScript class
//
// Author:      J.van.der.Steen@gobase.org
// Date:        2010-03-07
//
// Note:        Requires prototype.js
//
////////////////////////////////////////////////////////////////////////

var FormParticiperen = Class.create( FormBase,
{

    initialize: function($super, values)
    {
        this.valAssign(values, "type", "participeren");

        $super(values);

        /*
         * Editable properties
         */
        this.propAdd( values
                    , "aanhef"
                    , { type     : 'select'
                      , key      : 'aanhef'
                      , val      : ''
                      , valid    : 1
                      , validator: null
                      , options  : [ { key: 'dhr' , val: 'dhr'  }
                                   , { key: 'mevr', val: 'mevr' }
                                   ]
                      }
                    ) ;
        this.propAdd( values
                    , "firstname"
                    , { type     : 'text'
                      , size     : 64
                      , key      : 'voornaam'
                      , val      : ''
                      , valid    : 1
                      , validator: 'validateNonempty'
                      }
                    ) ;
        this.propAdd( values
                    , "lastname"
                    , { type     : 'text'
                      , size     : 64
                      , key      : 'achternaam'
                      , val      : ''
                      , valid    : 1
                      , validator: 'validateNonempty'
                      }
                    ) ;
        this.propAdd( values
                    , "phone"
                    , { type     : 'text'
                      , size     : 64
                      , key      : 'telefoonnummer'
                      , val      : ''
                      , valid    : 1
                      , validator: 'validatePhone'
                      }
                    ) ;
        this.propAdd( values
                    , "email"
                    , { type     : 'text'
                      , size     : 64
                      , key      : 'e-mail adres'
                      , val      : ''
                      , valid    : 1
                      , validator: 'validateEmail'
                      }
                    ) ;
        this.propAdd( values
                    , "opmerkingen"
                    , { type     : 'textarea'
                      , rows     : 5
                      , cols     : 64
                      , key      : 'opmerkingen'
                      , val      : ''
                      , valid    : 1
                      , validator: null
                      }
                    ) ;

        /*
         * System properties
         */
        this.propAdd( values
                    , "functionaris"
                    , { type     : 'hidden'
                      , size     : 64
                      , key      : 'functionaris'
                      , val      : 'voorzitter'
                      , valid    : 1
                      , validator: 'validateNonempty'
                      }
                    ) ;

        /*
         * Buttons
         */
        this.propAdd( values
                    , "versturen"
                    , { type     : 'button'
                      , size     : 32
                      , key      : 'versturen'
                      , val      : 'versturen'
                      , valid    : 1
                      , validator: 'validateNonempty'
                      , onclick  : 'save'
                      }
                    ) ;

        /**
         * Title of this form
         */
        this.setTitle('Ik wil graag helpen bij de organisatie van activiteiten van KNBB district Amsterdam');

    }

} ) ;

function emitParticiperen()
{
    var form = new FormParticiperen({});

    Element.update('content', form.edit());
}


