/*
 * File: RequestPriceQoute.js
 * Date: Fri May 14 2010 17:53:45 GMT-0400 (Eastern Daylight Time)
 * 
 * This file was generated by Ext Designer version xds-1.0.0.10c.
 * http://www.extjs.com/products/designer/
 *
 * This file will be generated the first time you export.
 *
 * You should implement event handling and custom methods in this
 * class.
 */

RequestPriceQoute = Ext.extend(RequestPriceQouteUi, {
    initComponent: function() {
        RequestPriceQoute.superclass.initComponent.call(this);
		this.SendMe.on('click',this.onSendMe, this);
    },
	onSendMe: function(myBtn, e )
	{
		// Send Data to Server
		this.getForm().submit({
							  url:'/RequestPriceQoute/RequestPriceQoute_Code.php',
							  params: {ResultFormat: 'json'},
							  waitMsg: 'Saving Data...',
                              scope: this,
							  success: function(form, action) {
			
									var result = action.result.data;
									var Quote = result.Qoute;
									this.DisplayQouteURL.setValue(' <a href=\"http://www.myrsvplive.com/Sales/' + Quote + '.php">View my price qoute</a>');
						            this.getLayout().setActiveItem(1);

								},
								failure: function(form, action) {									
									switch (action.failureType) {
										case Ext.form.Action.CLIENT_INVALID:
											Ext.Msg.alert('Failure', 'Please complete all the fields on the form');
											break;
										case Ext.form.Action.CONNECT_FAILURE:
											Ext.Msg.alert('Failure', 'There was a problem communicating with the server, please try again');
											break;
										case Ext.form.Action.SERVER_INVALID:
										   Ext.Msg.alert('Failure', action.result.msg);
								   }
								}

							  });
	}
});


