luci-base: validation.js: fix "unique" validator
Previous refactoring renamed the "data-type" attribute of widget markup containers to "data-widget", breaking the "unique" validator as it relies on it to lookup options. Fixes: #3341 Fixes: 13e9e3e9e ("treewide: fix "Unhandled token" errors with Lua CBI maps") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
4fe16b1ec6
commit
4f0d67a289
@ -535,9 +535,9 @@ var ValidatorFactory = L.Class.extend({
|
||||
|
||||
unique: function(subvalidator, subargs) {
|
||||
var ctx = this,
|
||||
option = findParent(ctx.field, '[data-type][data-name]'),
|
||||
option = findParent(ctx.field, '[data-widget][data-name]'),
|
||||
section = findParent(option, '.cbi-section'),
|
||||
query = '[data-type="%s"][data-name="%s"]'.format(option.getAttribute('data-type'), option.getAttribute('data-name')),
|
||||
query = '[data-widget="%s"][data-name="%s"]'.format(option.getAttribute('data-widget'), option.getAttribute('data-name')),
|
||||
unique = true;
|
||||
|
||||
section.querySelectorAll(query).forEach(function(sibling) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user