Current musing:

Using contenteditable to test css page layouts

This should be obvious, but I just realized that one could use the the HTML5 contenteditable feature to test page layouts. “Contenteditable” is a fancy little tag attribute that allows the user to edit the content contained in the element from the browser.

For example, Read more…

downloads

These guides are free, but if you have found them useful then please consider donating $2. Hey, that's less then the cup of coffee your drinking right?

subscriptions

« Blog home
modx date picker template variable not working

This is probably an obscure problem, but if it happens to you it is incredibly annoying. Hopefully the next person who struggles with this will search and find this answer.

Here’s the problem: you have a date template variable available for your modx templates. It is named “event_date”. You have enabled the “date formatter” widget so that user can click a little button to have a date chooser to popup in the manager. But, when you click the button for the date chooser nothing happens.

Here’s the solution: remove the underscore (“_”) in your template variable name. That’s it. Apparently the modx parser converts the underscore to an url safe entity and that messes up the javascript required to launch the popup.

Of course you might also want to be certain that popups are allowed by your browser for this domain!

14 Responses
  1. Just me says:

    Thanks for hint, I’ve struggled with same bug.

  2. Thor Jarle says:

    Excellent! I was wondering about this too, and luckily I found your page :) Now I have to find out how one make a date-field work…

  3. Tom says:

    Thanks, saved me a lot of frustration. Also same applies for hyphens (-).

  4. Ryan says:

    Thank you, thank you, thank you – that was driving me nuts – used (-) hyphen but so glad I found this.

  5. Kevin says:

    I don’t mean to preach, but I’ve found that making a habit of using camel case for all my variable names has helped with these obscure little issues, as well as with remembering later if I used an underscore, hyphen, or neither to separate words in a variable name. With camel case, first word is always lower-case, then each word after is upper-case. An example: thisIsCamelCase. It’s helped me – hopefully it will help others as well.

  6. Superb advice, actually, although I have to admit I find camel case difficult to read. Still it does solve a lot of issues before they show up.

  7. Bemi says:

    Thanks. This was killin my brain!

  8. Took me half an hour to find this post; then it took me five seconds to solve the problem. Thanks for sharing, I was going nuts!

  9. Stephen says:

    Thank you so much, I would have never figured this out!

  10. stu says:

    thanks dude, it took me giving the variable 5 different names over an hour and finding this post before I could figure it out. Thanks again

  11. Global says:

    Cheers man that had stumped me good n proper. Awesome post

  12. Eike Lang says:

    Thanks a bunch. Just tripped over this nasty one today myself. I’d still be pulling my hair out if it weren’t for your post. Cheers!

  13. I have another problem with the datepicker! It only goes back to 2000. I am trying to use it as a DOB field, so the date restriction makes it useless. Still trawling for a solution :)

  14. Really? I guess I’ve never used it to pick dates before 2000, but there must a solution. I wish I knew it for you! Good luck!

Have your say, leave a comment: