BobRay / newspublisher

Revolution version of NewsPublisher snippet
https://bobsguides.com/newspublisher-tutorial.html
20 stars 9 forks source link

Use different tpl for a single select or multiselect #62

Open DESIGNfromWITHIN opened 2 months ago

DESIGNfromWITHIN commented 2 months ago

Hi,

I need to use different ocde for a listbox multiselect and single select.

Both use optionoutertpl now and have [[+npx.multiple]] added, but is it possible to have a seperate tpl for a multi select option?

BobRay commented 2 months ago

Are you sure you need a separate Tpl chunk?

You can use different classes for single and mult-select listboxes.

This example is from the docs (the first one is single-select):

<fieldset class="np-tv-listbox" title="MyTv3 Description"><legend>MyTv3</legend>
<select name="MyTv3" size="3">
    <option value="Red" selected="selected" >Red</option>
    <option value="Blue">Blue</option>
    <option value="Green">Green</option>
</select>
</fieldset>

<fieldset class="np-tv-listbox-multiple" title="MyTv4 Description"><legend>MyTv4</legend>
<select name="MyTv4[]"  multiple="multiple" size="3">
    <option value="Red" selected="selected" >Red</option>
    <option value="Blue">Blue</option>
    <option value="Green" selected="selected" >Green</option>
</select>
</fieldset>
DESIGNfromWITHIN commented 2 months ago

Hi Bob thank you for the fast reply. I don't need a seperate chunk to get it to work (it's really great btw!) but would like to improve UX. I am using Tailwind + AlpineJS and would love to use JS improved inpout fields like these:

https://www.creative-tim.com/twcomponents/component/multi-select-alpine-js

DESIGNfromWITHIN commented 2 months ago

Have created Tailwind based tpl chunks btw for NewsPublisher. Looks pretty great I have to say. I you want I can add them to the extra maybe to have a Tailwind theme.

image

BobRay commented 2 months ago

Very nice. I did essentially the same thing with Notify/Subscribe for selecting user groups to send to, though I can't find the code for it. I'm swamped as usual and don't have time to integrate this into NewsPublisher, but I'm open to a PR for it.