Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use different tpl for a single select or multiselect #62

Open
DESIGNfromWITHIN opened this issue Aug 26, 2024 · 4 comments
Open

Use different tpl for a single select or multiselect #62

DESIGNfromWITHIN opened this issue Aug 26, 2024 · 4 comments

Comments

@DESIGNfromWITHIN
Copy link

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
Copy link
Owner

BobRay commented Aug 26, 2024

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
Copy link
Author

DESIGNfromWITHIN commented Aug 27, 2024

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
Copy link
Author

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
Copy link
Owner

BobRay commented Aug 27, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants