Forum for discussing general topics related to Couch.
6 posts Page 1 of 1
Hey guys im fairly new to couch CMS and i love it! im just having trouble wrapping my head around getting my drop down menu to work using a repeatable. im using tomselect.js and bootstrap on my webapp and want to set the options on my <select> tag on a repeatable so that i can add new pages from a global standpoint. i may not be explaining my self i hope it makes sense :cry: :cry:

here is the code.

the webapp
https://transgo.tech/ps.php?p=23


Code: Select all
           
<select style="width: inherit;" id="ex-dropdown-input" autocomplete="off" placeholder="Busca por transmision" onChange="Tselect(this.value)">

         
            
         <option selected disabled>Selecciona Transmision</option>

         <option value="<cms:show trans_url/>"><cms:show trans_name/> </option>


</select>
Hi :)

Assuming you have defined a repeatable-region containing the two fields as follows -
Code: Select all
<cms:repeatable name='select_items' label='Items'>
    <cms:editable name='trans_url' type='text' label='URL' />
    <cms:editable name='trans_name' type='text' label='Name' />
</cms:repeatable>

You can incorporate the values as follows -
Code: Select all
<select style="width: inherit;" id="ex-dropdown-input" autocomplete="off" placeholder="Busca por transmision" onChange="Tselect(this.value)">

         
           
         <option selected disabled>Selecciona Transmision</option>

         <cms:show_repeatable 'select_items'>   
            <option value="<cms:show trans_url/>"><cms:show trans_name/> </option>
         </cms:show_repeatable>


</select>

Does this help?
Thank you KK for the fast response! btw i LOVE COUCH its been a blessing learning how to use it. i think something is wrong with the javascript file im using because when it trys to render it. It doesnt show anything inputed in the drop down menu

im using tomselect.js to populate a searchable dropdown menu and i was hoping to populate it using a repeatable then making that repeatable global for all the templates. im maybe asking too much.
I am glad you found Couch useful :)

As for the problem -
It doesnt show anything inputed in the drop down menu

As you know, Couch is concerned only with outputting the markup (HTML, JS, CSS, whatever).
So to be sure that the code I suggested indeed works, do a view-source of the page and locate the place where the select box is being rendered.

If you see the <option>s being displayed there, your Couch code is fine and you should investigate why JS is not showing it.
Else, you should double-check the Couch code.

Once this part works, it will be easy to make it global across all templates.
Hope this helps.
I got it to work it took a second to wrap my head around it and now i can populate the dropdown from the repeatable now im trying to make it global so that it goes on to every page.

one thing more that i want to achieve with this is.
try to populate the values in the dropdown using relationships and k_page_name

is that possible?
is that possible?

Yes, of course. Try searching the docs and the forum for examples of how relations feature is used.
6 posts Page 1 of 1