Skip to content

Commit 6b38027

Browse files
committed
Fix issue with optional number params / fields with default values, getting reset if set to empty.
1 parent 74b561c commit 6b38027

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

htdocs/js/pages/PageUtils.class.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2572,7 +2572,10 @@ Page.PageUtils = class PageUtils extends Page.Base {
25722572
autocomplete: 'off',
25732573
spellcheck: 'false'
25742574
};
2575-
if (param.variant == 'number') text_args.step = 'any';
2575+
if (param.variant == 'number') {
2576+
text_args.step = 'any';
2577+
if (!(param.id in params)) text_args.value = '';
2578+
}
25762579
if (!param.variant || param.variant.match(/^(password|text|tel)$/)) {
25772580
// only show explorer icon for non-validating text variants
25782581
html += explore_start + self.getFormText(text_args) + explore_end;
@@ -4964,7 +4967,10 @@ Page.PageUtils = class PageUtils extends Page.Base {
49644967
autocomplete: 'off',
49654968
spellcheck: 'false'
49664969
};
4967-
if (param.variant == 'number') text_args.step = 'any';
4970+
if (param.variant == 'number') {
4971+
text_args.step = 'any';
4972+
if (!(param.id in params)) text_args.value = '';
4973+
}
49684974
if (!param.variant || param.variant.match(/^(password|text|tel)$/)) {
49694975
// only show explorer icon for non-validating text variants
49704976
html += explore_start + self.getFormText(text_args) + explore_end;

lib/job.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,6 @@ class Jobs {
155155

156156
if (plugin.runner) job.runner = true;
157157
else delete job.runner;
158-
159-
// plugin params may have changed outside of event, so re-copy missing ones
160-
if (plugin.params) plugin.params.forEach( function(param) {
161-
if (!(param.id in job.params)) {
162-
if (param.type == 'select') {
163-
job.params[ param.id ] = param.value.replace(/\,.*$/, '').replace(/^.+\[([\w\-\.]+)\]\s*$/, '$1');
164-
}
165-
else job.params[ param.id ] = param.value;
166-
}
167-
} );
168158
} // plugin
169159

170160
// apply placeholder substitution on all event params with job as context

0 commit comments

Comments
 (0)