forms: mark invalid prefill value explicitely (#36515)
This commit is contained in:
parent
625b574280
commit
03987a6e6c
|
@ -383,6 +383,12 @@ class FormPage(Directory, FormTemplateMixin):
|
|||
if not isinstance(v, str) and field.convert_value_to_str:
|
||||
v = field.convert_value_to_str(v)
|
||||
form.get_widget('f%s' % k).set_value(v)
|
||||
if field.type == 'item' and form.get_widget('f%s' % k).value != v:
|
||||
# mark field as invalid if the value was not accepted
|
||||
# (this is required by quixote>=3 as the value would
|
||||
# not be evaluated in the initial GET request of the
|
||||
# page).
|
||||
form.get_widget('f%s' % k).set_error(get_selection_error_text())
|
||||
if verified:
|
||||
form.get_widget('f%s' % k).readonly = 'readonly'
|
||||
form.get_widget('f%s' % k).attrs['readonly'] = 'readonly'
|
||||
|
|
Loading…
Reference in New Issue