We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44507
    • 3 Posts
    On ModX 2.2, I have a simple TV with Input Type Text and I wanted to setup a @binding to generate a dynamic default value pre-filled for the manager form.
    To test it I tried to use @EVAL returning a string - @EVAL return "hello world"; - but what I got as default value on the input form element is actually the whole @EVAL binding as it was a normal string.

    I've tried it with a Listbox Input Type and it actually works.

    I checked and rechecked the documentation and all available resources online, but there seems to be no mention of @bindings being available only for certain Input Types. Because nobody seems to be coming across this issue, I'm guessing that either i'm doing something wrong or it's bug (or undocumented feature).

    Can anyone give me a help? Or else point me in the right direction?

    Thanks.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      The raw default value is what is displayed on the form. What the value evaluates to is what is displayed using the TV tags on the front-end. This is expected behavior.

        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 44507
        • 3 Posts
        Ok. What I was thinking is that the default value @binding for that Input Type would get the values right there on the manager Form, like when you populate a dropdown list with a @binding. I actually need to calculate that default value dynamically so I was thinking I could take a shortcut by using @bindings. [ed. note: koriolis last edited this post 13 years, 3 months ago.]
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          No, the intention is that the editor sees actual raw default value and edits it as he sees fit.

          You could use a checkbox, with it checked by default. Or even hide the whole thing, if it's not supposed to be edited. In which case, why use a TV? A snippet would be more efficient.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 44507
            • 3 Posts
            The idea was for the editor to put in his value on the text box, but also to "suggest" a value for him, and that's where the "Default Value" @binding came up smiley