Can anyone explain how I can structure my CF component/output page to utilise the Bootstrap modal display dynamically? The code below works but I need the modal window to display only the output relating to the ‘cat_ID’, at the moment it displays all or some results, but never just those relating to that specific iteration of the 'cat_ID' Many thanks in advance...
<!---invoke services.cfc --->
<cfinvoke component="components.services" method="getServices" returnvariable="services">
</cfinvoke>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- Bootstrap core CSS -->
<link href="dist/css/bootstrap.css" rel="stylesheet">
<http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Services</title>
</head>
<body>
<div class="container">
<!-- Example thumbnail + text -->
<cfoutput query="services" group="cat_ID" groupcasesensitive="no">
<div class="col-md-3">
<div class="thumbnail">
<img src="images/some.jpg">
<div class="caption">
<h4>#cat_ID#</h4>
<p>#type_en#</p>
<p><button class="btn btn-default" data-
toggle="modal" data-target="###cat_ID#">View Details »</button></p>
</div>
</div>
</div>
</cfoutput>
<!-- Modal -->
<cfoutput query="services">
<div class="modal fade" id="#cat_ID#" tabindex="-1" role="dialog" aria-labelledby="One" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-
dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">#title_en#</h4>
</div>
<cfoutput>
<div class="modal-body">
#company# <br />
#title_en#
#Replace(desc_en, chr(13), '<br>','ALL')#<br />
</div>
</cfoutput>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</cfoutput>
</div>
<!-- Bootstrap core JavaScript
==================================================
-->
<!-- Placed at the end of the document so the pages
load faster -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="dist/js/bootstrap.min.js"></script>
</body>
</html>
The ‘services.cfc’ component:
<cfcomponent displayname="Services" hint="ColdFusion Component for showing services">
<!--- This function retrieves all services from the database --->
<cffunction name="getServices" hint="Gets services from the database" returntype="query">
<cfquery name="services">
SELECT *
FROM dbo.services
ORDER BY cat_ID
</cfquery>
<cfreturn services>
</cffunction>
</cfcomponent>