Guest User

Untitled

a guest
Feb 7th, 2012
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.24 KB | None | 0 0
  1. var employeeDetails=Ext.create('Ext.form.Panel', {
  2. id : 'form1',
  3. title : 'Employee Personal Details',
  4. url : 'EmployeeDetails.jsp',
  5. height: 600,
  6. //width: 500,
  7. x:400,
  8. width : 600,
  9. //autoHeight : true,
  10. frame : true,
  11. bodyPadding : '10 20',
  12. defaults : {
  13. x:60,
  14. anchor : '72%',
  15. msgTarget : 'under',
  16. allowBlank :true
  17. },
  18. items : [{
  19. xtype : 'combobox',
  20. id : 'empCode',
  21. fieldLabel : 'Employee Code',
  22. store : myStore,
  23. displayField : 'codeemp',
  24. valueField : 'codeemp',
  25. typeAhead : false,
  26. queryMode : 'local',
  27. forceSelection : true,
  28. editable : true,
  29. triggerAction : 'all',
  30. emptyText : 'Select one..'
  31. }, {
  32. xtype : 'textfield',
  33. allowBlank:true,
  34. name: 'fname',
  35. id : 'fname',
  36. maxLength : 20,
  37. minLength : 3,
  38. maxLengthText : 'should not exceed 20 characters.',
  39. fieldLabel : 'First Name',
  40. emptyText : 'Type your first name here',
  41. minLengthText : 'minimum 3 characters',
  42. maskRe : /[a-z]/i
  43. }, {
  44. xtype : 'textfield',
  45. name: 'mname',
  46. fieldLabel : 'Middle Name',
  47. id:'mname',
  48. maxLength : 20,
  49. minLength : 3,
  50. maxLengthText : 'should not exceed 20 characters.',
  51. emptyText : 'Type your middle name here',
  52. maskRe : /[a-z]/,
  53. msgTarget : 'under',
  54. minLengthText : 'minimum 3 characters'
  55. }, {
  56. xtype : 'textfield',
  57. fieldLabel : 'Last Name',
  58. id : 'lname',
  59. name:'lname',
  60. maxLength : 20,
  61. maxLengthText : 'should not exceed 20 characters.',
  62. minLength : 3,
  63. emptyText : 'Type your last name here',
  64. maskRe : /[a-z]/,
  65. msgTarget : 'under',
  66. minLengthText : 'minimum 3 characters'
  67. },{
  68. xtype : 'textfield',
  69. fieldLabel : 'User Name',
  70. id : 'uname',
  71. name:'uname',
  72. maxLength : 20,
  73. maxLengthText : 'should not exceed 20 characters.',
  74. minLength : 3,
  75. emptyText : 'Type your last name here',
  76. maskRe : /[a-z]/,
  77. msgTarget : 'under',
  78. minLengthText : 'minimum 3 characters'
  79. },{
  80. fieldLabel : 'Gender',
  81. xtype : 'radiogroup',
  82. id:'radios',
  83. columns : [50, 100],
  84. items : [{
  85. xtype : 'radiofield',
  86. boxLabel : 'Male',
  87. checked : true,
  88. id:'radios1',
  89. name:'gender',
  90. inputValue:'male'
  91. }, {
  92. xtype : 'radiofield',
  93. boxLabel : 'Female',
  94. id:'radios2',
  95. name:'gender',
  96. inputValue:'Female'
  97. }]
  98. },{
  99. xtype : 'datefield',
  100. id:'jdate',
  101. name : 'jdate',
  102. fieldLabel : 'Joining Date',
  103. format : 'd-m-Y',
  104. anchor : '72%'
  105. },{
  106. xtype : 'datefield',
  107. id:'dob',
  108. name : 'dob',
  109. fieldLabel : 'Date Of Birth',
  110. format : 'd-m-Y',
  111. anchor : '72%'
  112. },{
  113. xtype : 'combobox',
  114. id : 'designation',
  115. fieldLabel : 'designation',
  116. store : desgnation,
  117. displayField : 'dsgn',
  118. valueField : 'dsgn',
  119. typeAhead : false,
  120. queryMode : 'local',
  121. forceSelection : true,
  122. editable : true,
  123. triggerAction : 'all',
  124. emptyText : 'Select one..'
  125. },{
  126. xtype : 'combobox',
  127. id : 'role',
  128. fieldLabel : 'Role',
  129. store : role,
  130. displayField : 'rl',
  131. valueField : 'rl',
  132. typeAhead : false,
  133. queryMode : 'local',
  134. forceSelection : true,
  135. editable : true,
  136. triggerAction : 'all',
  137. emptyText : 'Select one..'
  138. },{
  139. xtype : 'textfield',
  140. id : 'emailId',
  141. fieldLabel : 'Email Id',
  142. vtype:'email',
  143. emptyText : 'Email like [email protected]'
  144. },{
  145. xtype : 'combobox',
  146. id : 'repPerson',
  147. fieldLabel : 'Reporting Person',
  148. store : rPerson,
  149. displayField : 'rp',
  150. valueField : 'rp',
  151. typeAhead : false,
  152. queryMode : 'local',
  153. forceSelection : true,
  154. editable : true,
  155. triggerAction : 'all',
  156. emptyText : 'Select one..'
  157. },{
  158. fieldLabel : 'Status',
  159. xtype : 'radiogroup',
  160. id:'radiosstatus',
  161. columns : [50, 100],
  162. items : [{
  163. xtype : 'radiofield',
  164. boxLabel : 'Active',
  165. checked : true,
  166. //id:'radios1',
  167. name:'st',
  168. inputValue:'Active'
  169. }, {
  170. xtype : 'radiofield',
  171. boxLabel : 'InActive',
  172. //id:'radios2',
  173. name:'st',
  174. inputValue:'InActive'
  175. }]
  176. }/*{
  177. xtype : 'combobox',
  178. id : 'employeeStatus',
  179. fieldLabel : 'Employee Status',
  180. store : empStatus,
  181. displayField : 'status',
  182. valueField : 'status',
  183. typeAhead : false,
  184. queryMode : 'local',
  185. forceSelection : true,
  186. editable : true,
  187. triggerAction : 'all',
  188. emptyText : 'Select one..'
  189. }*/,{
  190. xtype : 'textfield',
  191. id : 'empPancard',
  192. fieldLabel : 'Pan Card No',
  193. emptyText : 'Type your Pan Card Number here'
  194.  
  195. },{
  196. xtype : 'combobox',
  197. id : 'bloodGroup',
  198. fieldLabel : 'Blood Group',
  199. store : empBloodGroup,
  200. displayField : 'bloodGroup',
  201. valueField : 'bloodGroup',
  202. typeAhead : false,
  203. queryMode : 'local',
  204. forceSelection : true,
  205. editable : true,
  206. triggerAction : 'all',
  207. emptyText : 'Select one..'
  208. },{
  209. xtype : 'textfield',
  210. id : 'mobPhone',
  211. fieldLabel : 'Mobile Phone',
  212. emptyText : 'Type your Mobile Number here',
  213. maxLength : 10,
  214. maxLengthText : 'should not exceed 10 digits',
  215. maskRe : /[0-9]/
  216.  
  217. },{
  218. xtype : 'textfield',
  219. id : 'homePhone',
  220. fieldLabel : 'Home Phone',
  221. emptyText : 'Type your Home Phone Number here',
  222. maxLength : 13,
  223. maxLengthText : 'should not exceed 13 digits',
  224. maskRe : /[0-9]/
  225. },{
  226. xtype: 'fileuploadfield',
  227. id: 'form-file',
  228. emptyText: 'Select an image',
  229. fieldLabel: 'Photo',
  230. name: 'photo-path',
  231. buttonText: 'Upload Photo',handler: function() {
  232. mydata.getForm().submit({
  233. waitMsg:'Saving...',
  234. reset:false,
  235. params: {
  236. moreinfo: 'moreparams'
  237. },
  238. success: function(form, action){
  239. oldPreview = fileUploadPhotoPreview.autoEl.src;
  240. newPhoto = "butterfly.jpg";
  241. fileUploadPhotoPreview.el.dom.src=newPreview;
  242. mydata.findById('photo').reset();
  243. alert ("ok");
  244. }
  245.  
  246.  
  247. ,
  248. failure: function( form, action){
  249. alert ("error");
  250. }
  251. });
  252. },
  253. buttonCfg: {
  254. iconCls: 'upload-icon'
  255. }
  256. },{
  257. xtype : 'combobox',
  258. id : 'martialStatus',
  259. fieldLabel : 'Martial Status',
  260. store : marStatus,
  261. displayField : 'mstatus',
  262. valueField : 'mstatus',
  263. typeAhead : false,
  264. queryMode : 'local',
  265. forceSelection : true,
  266. editable : true,
  267. triggerAction : 'all',
  268. emptyText : 'Select one..'
  269. }],
  270. buttonAlign: 'center',
  271. buttons: [{
  272. text : 'Save',
  273. formBind : true,
  274. id:'btnsave',
  275. handler : function() {
  276. /*onClick:
  277.  
  278.  
  279. //alert('hi'+Ext.getCmp('fname').getValue());
  280.  
  281. // employeeDetails.getForm().submit({
  282. //method : 'POST',
  283. //waitTitle : 'Connecting',
  284. //waitMsg : 'Sending data...',
  285.  
  286.  
  287.  
  288. //success : function(field) {
  289.  
  290. Ext.Msg.alert('Confirm', 'Are you Sure want to save?',
  291. function(btn, text) {
  292.  
  293. if (btn == 'ok') {
  294.  
  295. var redirect = "final.html";
  296. window.location = redirect;
  297. employeeDetails.getForm().reset();
  298. }}
  299. );
  300. */
  301. }
  302.  
  303.  
  304.  
  305.  
  306. },{
  307. text: 'Clear',
  308. listeners:{
  309.  
  310. click: function(p) {
  311. employeeDetails.getForm().reset();
  312. }}}]
  313. });
Advertisement
Add Comment
Please, Sign In to add comment