Blog Sections Open

Using @SELECT TV Bindings Without Exposing Raw IDs

A useful legacy trick is to populate a TV from the database with @SELECT : @SELECT pagetitle, id FROM modx_site_content WHERE parent=10 The manager side works well, but frontend output often exposes the stored numeric ID

A useful legacy trick is to populate a TV from the database with @SELECT:

@SELECT pagetitle, id FROM modx_site_content WHERE parent=10

The manager side works well, but frontend output often exposes the stored numeric ID instead of the readable title. That is where many projects stumbled.

Why It Happens

The TV stores the value, not always the label. If you store id, the frontend will naturally print id unless you resolve it back to the related resource title.

Better Pattern

  • store the stable identifier you need for logic
  • resolve the readable label at render time
  • or store a label-value mapping explicitly if the dataset is small

This keeps the manager selection reliable while still allowing a clean frontend output for users.

Newer post

Listing Template Variables by Category with a Reusable tvs Snippet

How to build a helper snippet that outputs template variables by category and skips empty or excluded fields.

Older post

Troubleshooting eForm Attachments That Never Reach the Inbox

A practical checklist for eForm submissions where the email sends but file attachments never arrive.