Skip to content

Commit c6a23f6

Browse files
b6barincon9
authored andcommitted
Support different placeholders for each input when nb_inputs > 1 (#764)
Co-authored-by: Alejandro Rincon <arincon@mavenlink.com>
1 parent 49d99e5 commit c6a23f6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/template.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ QueryBuilder.prototype.getRuleInput = function(rule, value_id) {
265265
var name = rule.id + '_value_' + value_id;
266266
var c = filter.vertical ? ' class=block' : '';
267267
var h = '';
268+
var placeholder = Array.isArray(filter.placeholder) ? filter.placeholder[value_id] : filter.placeholder;
268269

269270
if (typeof filter.input == 'function') {
270271
h = filter.input.call(this, rule, name);
@@ -288,7 +289,7 @@ QueryBuilder.prototype.getRuleInput = function(rule, value_id) {
288289
if (filter.rows) h += ' rows="' + filter.rows + '"';
289290
if (validation.min !== undefined) h += ' minlength="' + validation.min + '"';
290291
if (validation.max !== undefined) h += ' maxlength="' + validation.max + '"';
291-
if (filter.placeholder) h += ' placeholder="' + filter.placeholder + '"';
292+
if (placeholder) h += ' placeholder="' + placeholder + '"';
292293
h += '></textarea>';
293294
break;
294295

@@ -297,14 +298,14 @@ QueryBuilder.prototype.getRuleInput = function(rule, value_id) {
297298
if (validation.step !== undefined) h += ' step="' + validation.step + '"';
298299
if (validation.min !== undefined) h += ' min="' + validation.min + '"';
299300
if (validation.max !== undefined) h += ' max="' + validation.max + '"';
300-
if (filter.placeholder) h += ' placeholder="' + filter.placeholder + '"';
301+
if (placeholder) h += ' placeholder="' + placeholder + '"';
301302
if (filter.size) h += ' size="' + filter.size + '"';
302303
h += '>';
303304
break;
304305

305306
default:
306307
h += '<input class="form-control" type="text" name="' + name + '"';
307-
if (filter.placeholder) h += ' placeholder="' + filter.placeholder + '"';
308+
if (placeholder) h += ' placeholder="' + placeholder + '"';
308309
if (filter.type === 'string' && validation.min !== undefined) h += ' minlength="' + validation.min + '"';
309310
if (filter.type === 'string' && validation.max !== undefined) h += ' maxlength="' + validation.max + '"';
310311
if (filter.size) h += ' size="' + filter.size + '"';

0 commit comments

Comments
 (0)