Forum
Using Slug
Hi,
I have tried to follow the dataselect tutorial:
https://solutions.grabaperch.com/templates/how-do-i-reuse-content-in-a-select-list
since I am trying to use data in one page on another page and according to a response to a previous post I made, this is possible however when I use the slug it displays the data on the page where supposedly I am trying to retrieve data from.
I'd have thought that in the first instance, it (slug) would be hidden but what it actually does is removes any capitalisation which is for a start worrying.
Secondly, in the .html template where I am using the dataselect "tag" nothing comes up in the list.
Here is the template for the page I am storing data in:
<table id="ScheduleTable">
<thead>
<tr>
<th>Code</th>
<th>Location</th>
<th>State</th>
<th>Dates</th>
</tr>
</thead>
<tbody>
<perch:repeater id="Course" title="Course">
<tr>
<td><perch:content id="code" type="text" label="Course Code" /><perch:content id="slug" for="code" type="slug" /></td>
<td><perch:content id="venue" type="select" label="Venue" options="Syd, Can, Bris, Adel, Mel, Per" label="Venues" suppress="true" allowempty="true" /><perch:if id="venue" value="Syd">Sydney</perch:if><perch:if id="venue" value="Can">Canberra</perch:if><perch:if id="venue" value="Bris">Brisbane</perch:if><perch:if id="venue" value="Adel">Adelaide</perch:if><perch:if id="venue" value="Mel">Melbourne</perch:if><perch:if id="venue" value="Per">Perth</perch:if></td>
<td><perch:content id="state" type="select" label="State" options="NSW, QLD, SA, VIC, WA" label="States" suppress="true" allowempty="true" /><perch:if id="state" value="NSW">NSW</perch:if><perch:if id="state" value="QLD">QLD</perch:if><perch:if id="state" value="SA">SA</perch:if><perch:if id="state" value="VIC">VIC</perch:if><perch:if id="state" value="WA">WA</perch:if></td>
<td><perch:content id="date" type="text" label="Date" /></td>
</tr>
</perch:repeater>
</tbody>
</table>
and here is the code for the template I am wanting to import data into:
<table id="ScheduleTable">
<thead>
<tr>
<th>Code</th>
<th>Location</th>
<th>State</th>
<th>Dates</th>
</tr>
</thead>
<tbody>
<perch:repeater id="Course" title="Course">
<tr>
<td><perch:content id="code" label="Code" type="dataselect" page="/course/index.php" region="Schedule" options="code" /></td>
<td><perch:content id="venue" label="Venue" type="dataselect" page="/course/index.php" region="Schedule" options="venue" /></td>
<td><perch:content id="state" label="State" type="dataselect" page="/course/index.php" region="Schedule" options="state" /></td>
<td><perch:content id="date" label="Date" type="dataselect" page="/course/index.php" region="Schedule" options="date" /></td>
</tr>
</perch:repeater>
</tbody>
</table>
Thank you for any help offered.
Upon other tests, I am getting the following output:
Code Location State Dates ra-d41d-cd98 ra-d41d-cd98 ra-d41d-cd98 ra-d41d-cd98
Can you post your diagnostic report?
I think this could be an issue with slugs inside repeaters, which is a scenario I've not seen before. I'll run some tests.
To stop a tag outputting, use the
suppress="true"
attribute.Hi Drew,
I may be confused as to the purpose of dataselect and slug however I am able to get a content tag to repeat but only in the original page if that makes any sense.
Thanks for your help.