Dashboard list field UI breaks when any list field has a null value

190 views
Skip to first unread message

Ali

unread,
May 8, 2025, 2:53:21 AMMay 8
to py4web
The dashboard provides a clean and user-friendly interface for fields of type list (e.g., list:string, list:integer). Users can enter comma-separated values, which are displayed as individual capsules and added to the existing lists. However, this UI breaks when a list field contains null—for example, if no default value is provided and no explicit value has been assigned either.

In fact, if even one list field contains a null value, the UI for all list fields on the editing page fails, even if those fields contain valid, non-null data.

To reproduce the issue, use the following example:

db.define_table('test2',
                Field('name'),
                Field('interests', 'list:string'),
                Field('locations', 'list:string', default=[]))  

Then insert a row with:

db.test2.insert(name="Alex")

Now, go to the dashboard and click on the row ID to open the editing page. The list-based UI will not function properly for interests or locations. That is because the value of interests is null for the newly added row.

Note: You can prevent this issue by explicitly setting default=[] for all list fields when defining the table.

-ali

Massimo DiPierro

unread,
May 8, 2025, 3:00:05 AMMay 8
to Ali, py4web
Thanks for all your tests. They are very valuable. I will try to address them all over the week-end.

--
You received this message because you are subscribed to the Google Groups "py4web" group.
To unsubscribe from this group and stop receiving emails from it, send an email to py4web+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/py4web/82dfbbc3-7b56-4c4c-908d-79a25479a504n%40googlegroups.com.

Ali

unread,
May 29, 2025, 7:19:32 PMMay 29
to py4web
Upon further testing, I noticed two new issues. None of them is very severe.

Issue 1. With IS_IN_SET , the order of elements entered in the dashboard matters. 

Consider the following minimal example:

master_set = {1: 'Philosophy',
              2: 'Society'}

db.define_table('test',
                Field('name'),
                Field('interests', 'list:integer', requires=IS_IN_SET(
                    master_set, error_message='Please make a selection.', multiple=True)))

Insert a row as follows:

db.test.insert(name="Alex")

Now, go to the dashboard and try adding 2,1 to the "interests" field. It does not work with the error message "Please make a selection."

Now try adding 1,2 (first one, then two). It will work with no issues!

Issue 2. The dashboard is not happy with the value null for a field for which the requirement IS_LIST_OF_EMAILS is added.

Consider the following minimal example:

db.define_table('test',
                Field('name'),
                Field('emails', 'list:string',
                      requires=IS_LIST_OF_EMAILS()))

Again, insert a row as follows:

db.test.insert(name="Alex")

Now go to the dashboard and try changing "Alex" to "John". The change will not be saved. The dashboard is not happy with the value null for the field "emails". If you enter a proper value for the field "emails", then the dashboard allows you to save the changes.

Note that a similar issue does NOT occur when you try inserting a row using a form. In that case, if you leave the text area corresponding to the field "emails" blank, the form will still be submitted. For what it is worth, after the form submission, the value of the field "emails" will be set to [] (an empty set).

Please let me know if more information is needed.

-ali

Tom Clerckx

unread,
Jun 9, 2025, 6:14:21 AMJun 9
to py4web
See other conversation for test results using the latest py4web code with the latest _dashboard.

Version info:
py4web
commit bf6a8240fcbf0bee7abad30f5989521b98f13633 (HEAD -> master, tag: v1.20250607.3, origin/master, origin/HEAD)
pydal
commit 8bf77404550f0230ca8a3b4b384ed474a3562e45 (HEAD -> master, tag: v20250607.2, origin/master, origin/HEAD)

Ali

unread,
Jun 10, 2025, 7:37:01 PMJun 10
to py4web
Thank you. I started testing the new dbadmin.

1. I verify that issue #1 is resolved.

2. The original issue #2 is resolved, too. However, I faced a new issue with the same test table. When I entered the email address "a...@gmail.com", it ended up showing as follows in the Details page:

a, l, i, @, g, m, a, i, l, ., c, o, m, 

- ali

Tom Clerckx

unread,
Jun 11, 2025, 12:00:01 PMJun 11
to py4web
I confirm.

In addition:
After adding one or more e-mail adresses, you cannot edit the record anymore via dbadmin.
The label "emails" is shown, but the existing records or the input field is not shown

Checking the html, I notice:
<input class="type-list-string" id="test_five_emails" name="emails" type="hidden" value="&quot;cl...@circus.com; fu...@circus.com; co...@circus.com&quot;">

Massimo

unread,
Jun 14, 2025, 2:18:40 AMJun 14
to py4web
I cannot reproduce this. The list of strigns should be rendered by this plugin and the value should not contain &quot; and should use , not ; as separator.

What is your model including validators?

Message has been deleted

Tom Clerckx

unread,
Jun 14, 2025, 5:48:54 PMJun 14
to py4web
To reproduce, I just copied the scaffold application and added the table:

db.define_table('test',
                Field('name'),
                Field('emails', 'list:string',
                      requires=IS_LIST_OF_EMAILS()))

See attached screen-recording that illustrates the issues in the dashboard:

1) In details mode: Strange representation of the email field (30s in the screen-recording)
2) In edit mode: the email is 'hidden' (58s in the screen-recording)
3) When making it visible by removing type="hidden", you can also see that the characters are not visible against the background, unless you select them (63s in the screen-recording)

Tested in a fresh pyenv-virtualenv:
Python version: 3.10.6 (main, Jan 14 2023, 23:48:13) [GCC 11.3.0]
py4web version: 1.20250607.2

Tom.
screen.mkv

Massimo

unread,
Jun 21, 2025, 8:56:56 PMJun 21
to py4web
I understand it. We do not handle uniformly the formatting of lists vs lists of emails. and it works for you in normal grid without utils.js because you are not using the widget to render lists but break in dashboard because it always uses the widget.

I need to figure out a way to have a uniform representation that works with and without widget and does not break existing code. This is a bit of a puzzle.

Massimo

Massimo

unread,
Jun 21, 2025, 11:18:12 PMJun 21
to py4web
The clean way to fix is change the way pydal works and give it default validators for list:string and list:reference.
I have now added this to pydal and this is consistent because IS_LIST_OF... ANYTHING

I will change utils.js to properly handle formatted output from these field, so I can simplify the grid.

I would appreciate if you could check the new logic in pydal.



Massimo

unread,
Jun 22, 2025, 7:27:03 PMJun 22
to py4web
I thinks is now fixed in master (make sure to force reload of utils.js if you use it, _dashboard and _scaffold do).
Please test with your own grids and let me know whether I broken something else.

Massimo

Message has been deleted

Jorge Salvat

unread,
Jun 26, 2025, 9:19:31 AMJun 26
to py4web
Something goes wrong with Pydal 20250622.1 and locale
i get this validation error
w-pydal-last 20250622.1.jpg
error is gone after
pip install --upgrade pydal==20250607.2 --no-cache-dir
w-pydal-prev 20250607.2.jpg

always using Py4web 1.20250623.1 with new Grid

Massimo

unread,
Jun 27, 2025, 1:40:48 AMJun 27
to py4web
Could you show me how you set the locale for the date format?

Ali

unread,
Jun 27, 2025, 1:55:42 AMJun 27
to py4web
I removed the _dashboard app and tried to get it back using: py4web setup apps. But it did not install the _dashboard app. It just shows the message "Done!". Any thoughts? I am thinking of manually copying the folder from the py4web GitHub repo, as a last resort.

- ali

Massimo DiPierro

unread,
Jun 27, 2025, 2:15:12 AMJun 27
to Ali, py4web
I just tried and cannot reproduce this. Did you delete the whole folder?

Copying from GitHub works but should not be necessary.

--
You received this message because you are subscribed to the Google Groups "py4web" group.
To unsubscribe from this group and stop receiving emails from it, send an email to py4web+un...@googlegroups.com.
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Ali

unread,
Jun 28, 2025, 3:21:12 PMJun 28
to py4web
I verify that the issue regarding email entry has been resolved. Thank you!
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
0 new messages