<![CDATA[ Blank first item in listbox - My Forums]]> https://forums.modx.com/thread/?thread=95730 <![CDATA[Blank first item in listbox]]> https://forums.modx.com/thread/95730/blank-first-item-in-listbox#dis-post-518199
I can quite successfully create my list using the following Input Option Values:
@SELECT pagetitle, id FROM modx_site_content WHERE template = 17 ORDER BY pagetitle ASC


However, it would be useful to have a first item in the list which was blank, rather than it always being the first actual page alphabetically. This is because there are some news items which will be about circuits that do not yet have a page elsewhere on the site and, currently, it is impossible to deselect an item from the list once it has initially been chosen and saved, even if in error.

I believe it might be possible to modify my Input Option Value to have to @SELECT values with a UNION to join them together, but that's about as far as I have got. Does anyone have any ideas? It does seem to be a bit of missing functionality within the listbox that would be much appreciated in future versions!]]>
neiltipton Jan 09, 2015, 02:28 PM https://forums.modx.com/thread/95730/blank-first-item-in-listbox#dis-post-518199
<![CDATA[Re: Blank first item in listbox]]> https://forums.modx.com/thread/95730/blank-first-item-in-listbox#dis-post-518269 ]]> gissirob Jan 11, 2015, 12:45 PM https://forums.modx.com/thread/95730/blank-first-item-in-listbox#dis-post-518269 <![CDATA[Re: Blank first item in listbox]]> https://forums.modx.com/thread/95730/blank-first-item-in-listbox#dis-post-518268 Quote from: gissirob at Jan 11, 2015, 06:10 PM
If the above doesn't work, then try this:
AND id not in (select id from modx_site_content where class_key = 'modWebLink' and template = 17)


Yeah, it's the latter! Thanks as ever.]]>
neiltipton Jan 11, 2015, 12:26 PM https://forums.modx.com/thread/95730/blank-first-item-in-listbox#dis-post-518268
<![CDATA[Re: Blank first item in listbox (Best Answer)]]> https://forums.modx.com/thread/95730/blank-first-item-in-listbox#dis-post-518267
AND id not in (select id from modx_site_content where class_key = 'modWebLink' and template = 17)

]]>
gissirob Jan 11, 2015, 12:10 PM https://forums.modx.com/thread/95730/blank-first-item-in-listbox#dis-post-518267
<![CDATA[Re: Blank first item in listbox]]> https://forums.modx.com/thread/95730/blank-first-item-in-listbox#dis-post-518266
@select "-Make selection-", "" from dual
union
(SELECT pagetitle, id 
FROM modx_site_content 
WHERE template = 17 
AND id not in (select id from modx_site_content where type = 'weblink' and template = 17)
ORDER BY pagetitle ASC)

If not, you get the drift...]]>
gissirob Jan 11, 2015, 11:32 AM https://forums.modx.com/thread/95730/blank-first-item-in-listbox#dis-post-518266
<![CDATA[Re: Blank first item in listbox]]> https://forums.modx.com/thread/95730/blank-first-item-in-listbox#dis-post-518265 Quote from: gissirob at Jan 10, 2015, 06:12 AM
This should work (not tested):
@select "-Make selection-", "" from dual
union
(SELECT pagetitle, id FROM modx_site_content WHERE template = 17 ORDER BY pagetitle ASC)

Just a thought - can I exclude any weblinks that use the same template?]]>
neiltipton Jan 11, 2015, 10:42 AM https://forums.modx.com/thread/95730/blank-first-item-in-listbox#dis-post-518265
<![CDATA[Re: Blank first item in listbox]]> https://forums.modx.com/thread/95730/blank-first-item-in-listbox#dis-post-518219 Quote from: gissirob at Jan 10, 2015, 06:12 AM
This should work (not tested):
@select "-Make selection-", "" from dual
union
(SELECT pagetitle, id FROM modx_site_content WHERE template = 17 ORDER BY pagetitle ASC)

Works a treat - many thanks!]]>
neiltipton Jan 10, 2015, 02:33 AM https://forums.modx.com/thread/95730/blank-first-item-in-listbox#dis-post-518219
<![CDATA[Re: Blank first item in listbox (Best Answer)]]> https://forums.modx.com/thread/95730/blank-first-item-in-listbox#dis-post-518217
@select "-Make selection-", "" from dual
union
(SELECT pagetitle, id FROM modx_site_content WHERE template = 17 ORDER BY pagetitle ASC)
]]>
gissirob Jan 10, 2015, 12:12 AM https://forums.modx.com/thread/95730/blank-first-item-in-listbox#dis-post-518217