Here's a quick tip (thanks to MODX Forum user squarou) about hiding the time field when editing date TVs in the MODX Manager. Unlike my previous article, this one will be short and sweet.
Hiding the time field for date TVs
Suppose you have a Resource that serves as a template for a Report that gets printed out at various times (let's say it's a quarterly report). Most of the form remains the same, but you've created several TVs the user can quickly fill in for the parts that change. One of the TVs contains the date. The default form of a "Date" TV includes the exact time, but no one cares what time of day the report was created. You only want the date, and you don't want to clutter things up by showing the time input. You just want the date section.
The Solution
I confess that I didn't know about this until I read squarou's post in the forums. When I saw a request to hide the Time field, I assumed it would have to be done with a plugin that loaded some JavaScript or inserted some custom CSS into the Manager page.
Luckily, there's a much easier way. Here are the steps:
- Create or Edit a date-type TV
- Click on the "Input Options" tab
- Make sure the Input Type is set to "Date"
- Scroll all the way to the bottom
- Set the "Hide time option for user" to
Yes6. Don't forget to save the TV
MODX will detect the option setting and hide the time field automatically. The time will be set to 00:00.
Coming Up
Imagine that another one of the TVs holds the name of the person creating the report. It could be a text TV. but it would be more convenient if the user could select from the name from a drop-down list. In my next article, we'll look at how to select users from a drop-down list in the TV and show their user information on the finished report.
About Bob Ray
Bob Ray is the author of the MODX: The Official Guide and dozens of MODX Extras including QuickEmail, NewsPublisher, SiteCheck, GoRevo, Personalize, EZfaq, MyComponent and many more. His website is Bob’s Guides. It not only includes a plethora of MODX tutorials but there are some really great bread recipes there, as well.
Learn more about Bob Ray.