Development
This commit is contained in:
parent
9e87212f4f
commit
edeb05acf7
1 changed files with 3 additions and 2 deletions
|
|
@ -462,7 +462,7 @@ def collect_form_originals(items, tokens):
|
||||||
if t == 'field':
|
if t == 'field':
|
||||||
name = item.get('name', '')
|
name = item.get('name', '')
|
||||||
input_type = item.get('input_type', 'text')
|
input_type = item.get('input_type', 'text')
|
||||||
if not name or input_type == 'hidden':
|
if not name or input_type in ('hidden', 'password'):
|
||||||
continue
|
continue
|
||||||
value = apply_tokens(item.get('value', ''), tokens)
|
value = apply_tokens(item.get('value', ''), tokens)
|
||||||
if input_type == 'checkbox':
|
if input_type == 'checkbox':
|
||||||
|
|
@ -1346,9 +1346,10 @@ def build_item(item, tokens, inherited_req=None):
|
||||||
inner = build_items(item.get('items', []), tokens, req)
|
inner = build_items(item.get('items', []), tokens, req)
|
||||||
hash_field = f'<input type="hidden" name="config_hash" value="{e(config_utils.config_hash())}"/>'
|
hash_field = f'<input type="hidden" name="config_hash" value="{e(config_utils.config_hash())}"/>'
|
||||||
originals = collect_form_originals(item.get('items', []), tokens)
|
originals = collect_form_originals(item.get('items', []), tokens)
|
||||||
|
has_data = any(v not in ('', []) for v in originals.values())
|
||||||
orig_field = (
|
orig_field = (
|
||||||
f'<input type="hidden" name="original_values" value="{e(json.dumps(originals))}"/>'
|
f'<input type="hidden" name="original_values" value="{e(json.dumps(originals))}"/>'
|
||||||
if originals else ''
|
if has_data else ''
|
||||||
)
|
)
|
||||||
field_specs, submit_sel = collect_form_specs(item.get('items', []))
|
field_specs, submit_sel = collect_form_specs(item.get('items', []))
|
||||||
script = build_form_script(field_specs, submit_sel) if (field_specs and submit_sel) else ''
|
script = build_form_script(field_specs, submit_sel) if (field_specs and submit_sel) else ''
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue