Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Checkboxes and seaching through the results

Status
Not open for further replies.

jenmerr

Programmer
Oct 5, 2007
15
IE
I have an enquiry form with a list of check boxes. In my search page it lists enquires that have been made.
If a person select two or more it wont loop through the list and bring back the ones that were selected.
Tried a number of queries and it starts returning nothing..

It will return the names of all of the entries in the table but wont show just the checkboxes that have been checked..


Would really appreciate your help.

<!--- <span class="PageTitle">List of Enquiry</span> --->
<cfparam name="url.menuid" default="">

<p> Please select the desired options and press list.

<!--- Search Form variable default section --->
<cfparam name="url.firstname" default="">
<cfparam name="form.firstname" default="#url.firstname#">
<cfparam name="url.lastname" default="">
<cfparam name="form.lastname" default="#url.lastname#">
<cfparam name="url.datecreated" default="">
<cfparam name="form.datecreated" default="#url.datecreated#">
<cfparam name="url.IWouldLikeFurtherInformationAboutID" default="">
<cfparam name="form.IWouldLikeFurtherInformationAboutID" default="#url.IWouldLikeFurtherInformationAboutID#">



<!--- Client Side validation code --->
<script language="JavaScript">
function doValidation(objForm){
objFormValidation = new glbDataValidation(objForm);
if(objFormValidation.isFieldValid( "firstname", " Firstname", " LengthMax=500 " )){
objField = objFormValidation.getFieldObject();
objField.focus();
return objFormValidation.doErrorAlertPrompt();
}
if(objFormValidation.isFieldValid( "lastname", " Lastname", " LengthMax=500 " )){
objField = objFormValidation.getFieldObject();
objField.focus();
return objFormValidation.doErrorAlertPrompt();
}
}
</script>


<!--- Starting the search interface --->
<cfoutput>
<form name="oEnquiryForm" method="post" action="#cgi.script_name#?area=#url.area#&action=#url.action#<cfif url.menuid gt "">&menuid=#url.menuid#</cfif>" onsubmit="return doValidation(this)" >

<table width="100%" class="ContentText">
<tr>
<td class="FormTextNormal"> Firstname </td>
<td><input name="firstname" value="#form.firstname#" type="text" size="25" ></td>
<td class="FormTextNormal"> Lastname </td>
<td><input name="lastname" value="#form.lastname#" type="text" size="25" ></td>
</tr>

<tr>
<td class="FormTextNormal"> Date Created </td>
<td>

<!--- In case of a date time data, fix the format --->
<cfif form.datecreated gt "" and year (form.datecreated) neq 1900>
<cfset form.datecreated = dateformat (form.datecreated, "dd/mm/yyyy")>
</cfif>

<input name="datecreated" value="#form.datecreated#" type="text" size="25" >

&nbsp;
<script language=javascript>
var basicCal = new calendar("FIELD:document.oEnquiryForm.datecreated;FORMAT:1");
basicCal.writeCalendar();
</script>

</td>
<td> <input type="Submit" name="Submit" value="List Enquiry"> </td>
<td> <a href="index.cfm?area=enquiry&action=Enquiryinsert<cfif url.menuid gt "">&menuid=#url.menuid#</cfif>">Add New Enquiry</a>
</td>
</tr>
</table>
</form>
</cfoutput>



<!--- Do the search only if search button was clicked --->
<cfif isDefined("form.Submit") or 1 >

<cfquery datasource="#request.dsname#" name="qIWouldLikeFurtherInformationAboutSelect">

select IWouldLikeFurtherInformationAboutID, IWouldLikeFurtherInformationAboutName, *
from IWouldLikeFurtherInformationAbout



where

1 = 1

<!--- IWouldLikeFurtherInformationAboutID in ('#IWouldLikeFurtherInformationAboutID#') --->

<!--- IWouldLikeFurtherInformationAboutID in (select IWouldLikeFurtherInformationAboutID,*
From Enquiry
where IWouldLikeFurtherInformationAboutID = '#form.IWouldLikeFurtherInformationAboutID#')
--->

<!--- IWouldLikeFurtherInformationAboutID in (select IWouldLikeFurtherInformationAboutID
from Enquiry
<cfif form.IWouldLikeFurtherInformationAboutID gt "">
where IWouldLikeFurtherInformationAboutID in ('#form.IWouldLikeFurtherInformationAboutID#')
</cfif>
) --->





</cfquery>


<!--- The query to gets the data to generate the list --->
<cfquery name="qEnquirySelect" datasource="#request.dsName#">
select Enquiry.EnquiryID ,
Enquiry.Firstname ,
Enquiry.Lastname,
Enquiry.Company,
Enquiry.Phone,
Enquiry.Email,
Enquiry.Mobile,
Enquiry.IWouldLikeFurtherInformationAboutID,
<!--- IWouldLikeFurtherInformationAbout.IWouldLikeFurtherInformationAboutName, --->
Enquiry.Comments,
Enquiry.PleaseTick,
Enquiry.DateCreated,
Enquiry.DateLastUpdated,
Enquiry.UpdatedBy,
Enquiry.CreatedBy
from Enquiry
left join IWouldLikeFurtherInformationAbout on IWouldLikeFurtherInformationAbout.IWouldLikeFurtherInformationAboutID = Enquiry.IWouldLikeFurtherInformationAboutID
where 1 = 1
<cfif form.firstname gt "">
and Enquiry.firstname = '#form.firstname#'
</cfif>
<cfif form.lastname gt "">
and Enquiry.lastname = '#form.lastname#'
</cfif>



</cfquery>




<cfif #qEnquirySelect.RecordCount# eq 0>


<!--- Display the record count --->
<p align="right">
Total of <span class="RecordTotal"> 0 </span> record found.
<p>

<cfelse>
<!--- The Enquiry Table --->
<table width="100%" class="ContentTable" border="0" cellpadding="4" cellspacing="0" >
<tr class="ContentHead" >
<td class="ContentHead" colspan="14">
<table width="100%">
<tr>
<td align="left" class="ContentHead">
List of Enquirys
</td>
<td align="right" class="ContentHead">

<cfoutput>
Total of <span class="RecordTotal"> #qEnquirySelect.RecordCount# </span> record(s) found.


</cfoutput>
</td>
</tr>
</table>
</td>
</tr>
<tr >
<td height="1" class="ContentText" colspan="14"> </td>
</tr>
<tr class="ContentHead" >
<td>Firstname </td>
<td>Lastname </td>
<td>Company </td>
<td>Phone </td>
<td>Email </td>
<td>Mobile </td>
<td>I Would Like Further Information About </td>
<td>Comments </td>
<td>Please Tick </td>
<td> Delete </td>
</tr>
<cfoutput query="qEnquirySelect" >
</tr>
<cfif qEnquirySelect.CurrentRow mod 2 eq 1>
<tr class="ContentText" title="Last Updated on #dateformat(DateLastUpdated, "dd/mm/yyyy")#" valign="top">
<cfelse>
<tr class="ContentTextOdd" title="Last Updated on #dateformat(DateLastUpdated, "dd/mm/yyyy")#" valign="top">
</cfif>
<td>#Firstname# &nbsp; </td>
<td>#Lastname# &nbsp; </td>
<td>#Company# &nbsp; </td>
<td>#Phone# &nbsp; </td>
<td>#Email# &nbsp; </td>
<td>#Mobile# &nbsp; </td>
<td>





<cfloop list="#form.IWouldLikeFurtherInformationAboutID#" query="qIWouldLikeFurtherInformationAboutSelect" >
#qIWouldLikeFurtherInformationAboutSelect.IWouldLikeFurtherInformationAboutName# <br>
</cfloop>

<cfdump var="#qIWouldLikeFurtherInformationAboutSelect#">


</td>
<td>#Comments# &nbsp; </td>
<td> <cfif PleaseTick eq 1> Active <cfelse> Inactive </cfif> </td>
<td> <a onClick="javascript:return deleteConfirmation('Enquiry');" href="#cgi.script_name#?area=enquiry&action=enquirydeleteaction&enquiryid=#Enquiryid#<cfif url.menuid gt "">&menuid=#url.menuid#</cfif>">Delete</a> </td>
</tr>
<tr >
<td height="1" class="ContentHead" colspan="14"> </td>
</tr>
</cfoutput>
<tr >
<td height="2" align="right" class="ContentHead" colspan="14">
<!--- <cfoutput>
<a href="index.cfm?area=enquiry&action=Enquiryinsert<cfif url.menuid gt "">&menuid=#url.menuid#</cfif>">Add New Enquiry</a>
</cfoutput> --->
</td>
</tr>
</table>

</cfif>

</cfif>


 
Where are the checkboxes? I searched your post for type="checkbox" and didn't find a thing.

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
Pity the insomniac dyslexic agnostic. He stays up all night, wondering if there really is a dog.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top