﻿
Ext.onReady(function()
{    
    Ext.QuickTips.init(); 
           
    var myForm = new Ext.FormPanel(
    {    
        //code by Ext GUI Builder        
        labelAlign:"top",
        frame:false,     
        border:false,   
        ctCls: 'emailForm',
        width:520,        
        items:    
        [{
            layout:"column",            
            border:false,
            items:[
            {
                columnWidth:0.5,
                layout:"form",
                border:false,
                items:[{
                    xtype:"textfield",
                    fieldLabel:"First Name",                    
                    width:245,
                    id:'FirstName'
                  },{
                    xtype:"textfield",
                    fieldLabel:"Last Name",
                    width:245,
                    id:'LastName'
                  }]                
              },
              {
                columnWidth:0.5,
                layout:"form",
                border:false,
                items:[{
                    xtype:"textfield",
                    fieldLabel:"Your Email Address",                    
                    width:245,
                    id:'UserEmail'                    
                  },{
                    xtype:"textfield",
                    fieldLabel:"Phone Number",                    
                    width:245,
                    id:'PhoneNumber'
                  }]
              }]
          },{
            xtype:"datefield",
            fieldLabel:"Wedding Date",
            width:245,
            id:'WeddingDate'
          },{
            xtype:"htmleditor",
            fieldLabel:"Comments or Questions",
            id:'Comments',
            width:505,
            height:150     
          }]                                                                                      
    });
        
    myForm.addButton("Register",function()
    {
        myForm.form.submit(
        {
            method: 'post',
            url: 'registry.ashx',
            waitMsg: 'Registering',
            failure: function(form,response)
            {
                  Ext.Msg.alert('Error',response.result.message);                  
            },
            success: function(form,response)
            {
                  Ext.Msg.alert('Success',response.result.message);                  
            }                
        });                  
    });

    myForm.render('div_registry');     
});


 
 
 

    