[TASK] Remove breakOnError option from wizard
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Resources / Public / JavaScript / Wizard / Elements / Predefined / Name.js
1 Ext.namespace('TYPO3.Form.Wizard.Elements.Predefined');
2
3 /**
4 * The predefined NAME element
5 *
6 * @class TYPO3.Form.Wizard.Elements.Predefined.Name
7 * @extends TYPO3.Form.Wizard.Elements.Basic.Fieldset
8 */
9 TYPO3.Form.Wizard.Elements.Predefined.Name = Ext.extend(TYPO3.Form.Wizard.Elements.Basic.Fieldset, {
10 /**
11 * Initialize the component
12 */
13 initComponent: function() {
14 var config = {
15 configuration: {
16 attributes: {
17 "class": 'predefined-name fieldset-subgroup fieldset-horizontal label-below',
18 dir: '',
19 id: '',
20 lang: '',
21 style: ''
22 },
23 legend: {
24 value: TYPO3.l10n.localize('elements_legend_name')
25 },
26 various: {
27 prefix: true,
28 suffix: true,
29 middleName: true
30 }
31 }
32 };
33
34 // apply config
35 Ext.apply(this, Ext.apply(config, this.initialConfig));
36
37 // call parent
38 TYPO3.Form.Wizard.Elements.Predefined.Name.superclass.initComponent.apply(this, arguments);
39
40 this.on('configurationChange', this.rebuild, this);
41
42 this.on('afterrender', this.rebuild, this);
43 },
44
45 /**
46 * Add the fields to the containerComponent of this fieldset,
47 * according to the configuration options.
48 *
49 * @param component
50 */
51 rebuild: function(component) {
52 this.containerComponent.removeAll();
53 var dummy = this.containerComponent.findById('dummy');
54 if (dummy) {
55 this.containerComponent.remove(dummy, true);
56 }
57 if (this.configuration.various.prefix) {
58 var prefix = this.containerComponent.add({
59 xtype: 'typo3-form-wizard-elements-basic-textline',
60 isEditable: false,
61 cls: '',
62 configuration: {
63 label: {
64 value: TYPO3.l10n.localize('elements_label_prefix')
65 },
66 attributes: {
67 name: 'prefix',
68 size: 4
69 },
70 layout: 'back'
71 }
72 });
73 }
74 var firstName = this.containerComponent.add({
75 xtype: 'typo3-form-wizard-elements-basic-textline',
76 isEditable: false,
77 cls: '',
78 configuration: {
79 label: {
80 value: TYPO3.l10n.localize('elements_label_firstname')
81 },
82 attributes: {
83 name: 'firstName',
84 size: 10
85 },
86 layout: 'back',
87 validation: {
88 required: {
89 showMessage: true,
90 message: '*',
91 error: 'Required'
92 }
93 }
94 }
95 });
96 if (this.configuration.various.middleName) {
97 var middleName = this.containerComponent.add({
98 xtype: 'typo3-form-wizard-elements-basic-textline',
99 isEditable: false,
100 cls: '',
101 configuration: {
102 label: {
103 value: TYPO3.l10n.localize('elements_label_middlename')
104 },
105 attributes: {
106 name: 'middleName',
107 size: 6
108 },
109 layout: 'back'
110 }
111 });
112 }
113 var lastName = this.containerComponent.add({
114 xtype: 'typo3-form-wizard-elements-basic-textline',
115 isEditable: false,
116 cls: '',
117 configuration: {
118 label: {
119 value: TYPO3.l10n.localize('elements_label_lastname')
120 },
121 attributes: {
122 name: 'lastName',
123 size: 15
124 },
125 layout: 'back',
126 validation: {
127 required: {
128 showMessage: true,
129 message: '*',
130 error: 'Required'
131 }
132 }
133 }
134 });
135 if (this.configuration.various.suffix) {
136 var suffix = this.containerComponent.add({
137 xtype: 'typo3-form-wizard-elements-basic-textline',
138 isEditable: false,
139 cls: '',
140 configuration: {
141 label: {
142 value: TYPO3.l10n.localize('elements_label_suffix')
143 },
144 attributes: {
145 name: 'suffix',
146 size: 4
147 },
148 layout: 'back'
149 }
150 });
151 }
152 this.containerComponent.doLayout();
153 }
154 });
155
156 Ext.reg('typo3-form-wizard-elements-predefined-name', TYPO3.Form.Wizard.Elements.Predefined.Name);