Просмотр исходного кода

Moved custom field's placement

Brendan Abolivier 7 лет назад
Родитель
Сommit
74c102beaf
2 измененных файлов: 10 добавлений и 7 удалений
  1. 1
    1
      README.md
  2. 9
    6
      front/form.js

+ 1
- 1
README.md Просмотреть файл

@@ -120,7 +120,7 @@ The `customFields` section is optional and describes custom form fields, which a
120 120
 
121 121
 ## Custom fields
122 122
 
123
-SMAM allows you to add custom fields to your form (in addition to the default ones, which are the sender's name, the sender's e-mail address, the message's subject and the message's content). These fields will be added in your form below the content's field, in a tag defined by the settings file (one of <input>, <select> and <textarea>). We'll see below how to set the field's type.
123
+SMAM allows you to add custom fields to your form (in addition to the default ones, which are the sender's name, the sender's e-mail address, the message's subject and the message's content). These fields will be added in your form just above the content's field, in a tag defined by the settings file (one of <input>, <select> and <textarea>). We'll see below how to set the field's type.
124 124
 
125 125
 A custom field is defined in the `customFields` section of your settings file, as described below:
126 126
 

+ 9
- 6
front/form.js Просмотреть файл

@@ -130,12 +130,6 @@ function generateForm(id) {
130 130
 			label: lang.form_subj_label,
131 131
 			type: 'text',
132 132
 			required: true
133
-		}),
134
-		text: getField({
135
-			name: items.text,
136
-			label: lang.form_mesg_label,
137
-			type: 'textarea',
138
-			required: true
139 133
 		})
140 134
 	};
141 135
 
@@ -145,11 +139,20 @@ function generateForm(id) {
145 139
 		DOMFields[fieldName] = getField(field);
146 140
 	}
147 141
 
142
+	// Add the message's textarea
143
+	DOMFields[text] = getField({
144
+		name: items.text,
145
+		label: lang.form_mesg_label,
146
+		type: 'textarea',
147
+		required: true
148
+	});
149
+
148 150
 	// Adding all nodes to document
149 151
 	for(let field in DOMFields) {
150 152
 		el.appendChild(DOMFields[field]);
151 153
 	}
152 154
 
155
+
153 156
 	// Adding submit button
154 157
 	el.appendChild(getSubmitButton('form_subm', lang.form_subm_label));
155 158