From 6fedc7a9eda870e36d3307c710469fe97a0c501a Mon Sep 17 00:00:00 2001 From: John Flores Date: Tue, 5 Feb 2019 16:20:52 -0800 Subject: [PATCH] Support different placeholders for each input when nb_inputs > 1 Co-authored-by: Alejandro Rincon --- src/template.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/template.js b/src/template.js index c01d43d1..004d4693 100644 --- a/src/template.js +++ b/src/template.js @@ -265,6 +265,7 @@ QueryBuilder.prototype.getRuleInput = function(rule, value_id) { var name = rule.id + '_value_' + value_id; var c = filter.vertical ? ' class=block' : ''; var h = ''; + var placeholder = Array.isArray(filter.placeholder) ? filter.placeholder[value_id] : filter.placeholder; if (typeof filter.input == 'function') { h = filter.input.call(this, rule, name); @@ -288,7 +289,7 @@ QueryBuilder.prototype.getRuleInput = function(rule, value_id) { if (filter.rows) h += ' rows="' + filter.rows + '"'; if (validation.min !== undefined) h += ' minlength="' + validation.min + '"'; if (validation.max !== undefined) h += ' maxlength="' + validation.max + '"'; - if (filter.placeholder) h += ' placeholder="' + filter.placeholder + '"'; + if (placeholder) h += ' placeholder="' + placeholder + '"'; h += '>'; break; @@ -297,14 +298,14 @@ QueryBuilder.prototype.getRuleInput = function(rule, value_id) { if (validation.step !== undefined) h += ' step="' + validation.step + '"'; if (validation.min !== undefined) h += ' min="' + validation.min + '"'; if (validation.max !== undefined) h += ' max="' + validation.max + '"'; - if (filter.placeholder) h += ' placeholder="' + filter.placeholder + '"'; + if (placeholder) h += ' placeholder="' + placeholder + '"'; if (filter.size) h += ' size="' + filter.size + '"'; h += '>'; break; default: h += '