We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30107
    • 44 Posts
    Hi,

    first of all, I’m using modx 1.0.2 evolution.
    I use a DropDownList in one of my TVs, with the following binding:
    @SELECT pagetitle,id FROM modx_site_content WHERE published=1 AND hidemenu=0 ORDER by pagetitle ASC

    It shows dynamically all resources, which works well so far.
    The DropDownList takes the id (for example: 123) as option value and the pagetitle (here: mypagetitle) as option text:
     <option value="123">mypagetitle</option>

    However, I would like to return the id after the option text, too. The HTML code of TV looks like that:
     <option value="123">mypagetitle (123)</option>

    How can I achieve this?

    Thanks a lot in advance!
      • 4172
      • 5,888 Posts
      perhaps this one can do it:
      @SELECT CONCAT(pagetitle,'(',CAST(id AS CHAR),')') as pagetitle,id FROM modx_site_content WHERE published=1 AND hidemenu=0 ORDER by pagetitle ASC
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 30107
        • 44 Posts
        Quote from: Bruno17 at Jan 25, 2010, 09:31 AM

        perhaps this one can do it:
        @SELECT CONCAT(pagetitle,'(',CAST(id AS CHAR),')') as pagetitle,id FROM modx_site_content WHERE published=1 AND hidemenu=0 ORDER by pagetitle ASC


        Bruno, thanks a lot! smiley

        I had to solve some other problems with my website first, but now I can come back on this. I have an additional question: I use a "DropDown List Menu" (= <select>) in TV options to ouput the @select result. As default, the first dataset is selected in backend, like:

        <select id="tv40" name="tv40" size="1" onchange="documentDirty=true;">
          <option value="73">page abc (73)</option>
          <option value="74">page cde (74)</option>


        and so on...

        Is there a way to select "nothing" as default, like:

        <select id="tv40" name="tv40" size="1" onchange="documentDirty=true;">
          <option value="">no selection</option> 
          <option value="73">page abc (73)</option>
          <option value="74">page cde (74)</option>
          ...


        Thanks in advance!