I have a form which takes in the values of First Name, Last Name and DOB. I have two tables: TableA and TableB. Each table may contain information of the person name that is entered in the form. What I would like to do, in ColdFusion, write a query where I take the user inputs and compare which Table contains the info. Once I find which table contains the user info, display particular columns that pertain in that table.
Below is the form:
<Form name="ERHospital" Method="Post" class="a">
<div align="center" style="margin-top:10pt; margin-bottom:10pt">
<table Border="0" width="100%" align="center" cellpadding=0 cellspacing=0 >
<tr>
<td class="m" id="fName">First Name </td>
<td>
<input class="a" id="FirstName" name="FirstName" value="<cfoutput></cfoutput>" size="15">
</td>
<td class="m" id="lName">Last Name </td>
<td>
<input class="a" id="LastName" name="LastName" value="<cfoutput></cfoutput>" size="15">
</td>
<td class="m" id="DOB">
DOB<br />
<font color="##CC0000" size="1" style="italic">(mm/dd/yyyy)</font>
</td>
<td>
<input type="text" id="BirthDt" name ="BirthDt" id="BirthDt" maxlength="10" size="10">
</td>
</tr>
<tr>
<!---<td class="m" id="Hospital">Hospital</td>
<td>
<select name="hosp" id="hosp"></select>
</td>--->
<!---<td class="m" colspan="2"></td>
<td class="m">
<input type="button" value="Submit" onClick="SubmitMe(); checkFields();" name="SubmitEmpBtn" style="font-size:12px; font-family:Arial, Helvetica, sans-serif; font-weight:bold">
</td>
<td align="left">
<input type="button" name="Clear" value="Clear" onClick="ClearForm()" style="font-size:12px; font-family:Arial, Helvetica, sans-serif; font-weight:bold">
</td>
</tr>--->
</table>
<div style="text-align:center; margin-top:15pt"><input type="button" value="Submit" onClick="SubmitMe(); checkFields();" name="SubmitEmpBtn" style="font-size:12px; font-family:Arial, Helvetica, sans-serif; font-weight:bold"> <input type="button" name="Clear" value="Clear" onClick="ClearForm()" style="font-size:12px; font-family:Arial, Helvetica, sans-serif; font-weight:bold"> </div>
<!---<table align="center">
<TR>
<TD align="center"><input type="button" value=" Submit " onClick="SubmitMe()" name="SubmitEmpBtn" style="font-size:14px; font-family:Arial, Helvetica, sans-serif"> <input type="button" name="Clear" value=" Clear " onClick="ClearForm()" style="font-size:14px; font-family:Arial, Helvetica, sans-serif"> </td>
</tr>
</table>
</table>--->
</div>
</FORM>
If the user is guaranteed to be in only one table, then you can use a UNION ALL like the following:
<cfquery name="myquery" datasourse="#myDSN#">
SELECT <userField1>, <userField2>
FROM Table1
WHERE
FirstName = <cfqueryparam value="#form.firstname#" cfsqltype="cf_sql_varchar">
AND
LastName = <cfqueryparam value="#form.lastname#" cfsqltype="cf_sql_varchar">
UNION ALL
SELECT <userField1>,<userField2>
FROM Table2
WHERE
FirstName = <cfqueryparam value="#form.firstname#" cfsqltype="cf_sql_varchar">
AND
LastName = <cfqueryparam value="#form.lastname#" cfsqltype="cf_sql_varchar">
</cfquery>
If the user is only in one table, you'll only get the results for your requested user.
EDIT: I would also add that I am not a big fan of using form, url or any other external variable in a sql query without making sure they have been sanitized. But that is a WHOLE different type of discussion. :-)
Related
I have a dialog displayed having clicked on an element. In this dialog there are 2 tables (HTML). A table within a table.
Table 1 has the text "Match audit codes"
Table 2 has some rows and columns. Column 1 has a checkbox. Column 2 has a char value, e.g. the letter "I")
Column 3 has some text e.g. "Matched to full address"
I would like to locate the checkbox from column 1 which has the text description "Matched to Full Address" and the parent table has the text "Match audit codes"
I tried the following Xpath which locates the checkbox which has the text "Matched to full address"
//div[contains(text(), "Matched to full address")]/ancestor::tr[1]/td[1]//input
My Selenium Python script will not click this checkbox. The developer says there could be more than 1 "Matched to full address" in the HTML somewhere.
I need the Xpath to start from the parent table which has the text "Match audit codes" and then go down to the next table which has the text "Matched to full address" and then locate the checkbox.
How can i build the Xpath please?
The HTML is:
<table class="GJPPK2LBAL" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td align="left" style="vertical-align: top;">
<div class="GJPPK2LBPK">Match audit codes</div>
</td>
<td align="left" style="vertical-align: top;">
<button class="gwt-Button GJPPK2LBLK" type="button">X</button>
</td>
</tr>
</tbody>
</table>
<table class="GJPPK2LBOK" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td align="left" style="vertical-align: middle;">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<tr>
<td align="left" style="vertical-align: top;">
<div style="overflow: auto; position: relative; width: 25em;">
<div style="position: relative;">
<table class="GJPPK2LBJE" cellspacing="0"
__gwtcellbasedwidgetimpldispatchingfocus="true"
__gwtcellbasedwidgetimpldispatchingblur="true">
<thead aria-hidden="false">
<colgroup>
<tbody>
<tr class="GJPPK2LBCD" __gwt_subrow="0" __gwt_row="0">
<td class="GJPPK2LBBD GJPPK2LBDD GJPPK2LBED">
<div __gwt_cell="cell-gwt-uid-5972" style="outline-style:none;">
<input type="checkbox" tabindex="-1"/>
</div>
</td>
<td class="GJPPK2LBBD GJPPK2LBDD">
<div __gwt_cell="cell-gwt-uid-5973" style="outline-style:none;">I</div>
</td>
<td class="GJPPK2LBBD GJPPK2LBDD GJPPK2LBOD">
<div __gwt_cell="cell-gwt-uid-5974" style="outline-style:none;">Matched to
full address
</div>
</td>
</tr>
<tr class="GJPPK2LBCE" __gwt_subrow="0" __gwt_row="1">
<td class="GJPPK2LBBD GJPPK2LBDE GJPPK2LBED">
<div __gwt_cell="cell-gwt-uid-5972" style="outline-style:none;">
<input type="checkbox" tabindex="-1"/>
</div>
</td>
<td class="GJPPK2LBBD GJPPK2LBDE">
<div __gwt_cell="cell-gwt-uid-5973" style="outline-style:none;">B</div>
</td>
<td class="GJPPK2LBBD GJPPK2LBDE GJPPK2LBOD">
<div __gwt_cell="cell-gwt-uid-5974" style="outline-style:none;">Matched to
building
</div>
</td>
</tr>
<tr class="GJPPK2LBCD" __gwt_subrow="0" __gwt_row="2">
<tr class="GJPPK2LBCE" __gwt_subrow="0" __gwt_row="3">
</tbody>
<tbody style="display: none;">
<tfoot style="display: none;" aria-hidden="true"/>
</table>
Thanks,
Riaz
I'm not sure if I'm getting your question. You want to locate the table containing "Match audit codes", then move on to the next table containing "Matched to full address", and inside that table search for the checkbox in the same row as the "Matched to full address" text?
If so, then it should look like this:
//table[.//div[text()='Match audit codes']]/following-sibling::table[.//div[.='Matched to full address']][1]//div[.='Matched to full address']/ancestor::tr[1]/td//input[#type='checkbox'][1]
If .='Matched to full address' doesn't work, try contains(.,'Matched to full address') instead.
Here is a tip:
Find all elements with text to be matched.
List<WebElement> texts = driver.findElements(By.xpath("//td[#class='GJPPK2LBBD GJPPK2LBDE GJPPK2LBOD']"));
Now store the indexes of elements which contains your desired text.
List<Integer> list = new ArrayList<>();
for(int i=0;i<list.size();i++){
if(text.get(i).getText().equals("Matched to full address"))
list.add(i);
}
Now you have the list of all indexes with text as 'Matched to full address'. You can now call the corresponding check boxes and play.
List<WebElement> checks = driver.findElements(By.xpath("//td[#class='GJPPK2LBBD GJPPK2LBDE GJPPK2LBED']"));
for(int index:checks){
WebElement cb = checks.get(index);
//Do something with cb
}
Hope it helps.
I have a HTML table with some rows of input fields. Each input field has a value.
The input field I am looking for is any input field which contains the text "filter"
The actual text is "filter2" or it could be "filter3"
Can i use the contains keyword in the Xpath to find "filter" for the #value attribute?
The XPATH i have constructed is:
//table[#id="reporting_add_report_tab_manual_ct_match_filters"]/tbody//tr//td//input[#value="filter2"]
I would like to find the input field where it has filter in the value attribute, exclude the number 2
The HTML snippet is:
<table id="reporting_add_report_tab_manual_ct_match_filters" class="GJPPK2LBAV border" cellspacing="0"
__gwtcellbasedwidgetimpldispatchingfocus="true" __gwtcellbasedwidgetimpldispatchingblur="true">
<thead aria-hidden="false">
<colgroup>
<tbody style="">
<tr class="GJPPK2LBCD GJPPK2LBMD" __gwt_subrow="0" __gwt_row="0">
<td class="GJPPK2LBBD GJPPK2LBDD GJPPK2LBED">
<div __gwt_cell="cell-gwt-uid-684" style="outline-style:none;">
<input type="checkbox" tabindex="-1"/>
</div>
</td>
<td class="GJPPK2LBBD GJPPK2LBDD">
<div __gwt_cell="cell-gwt-uid-685" style="outline-style:none;">
<span>
<input type="text" tabindex="-1" value="rule1"/>
</span>
<span>
</div>
</td>
<td class="GJPPK2LBBD GJPPK2LBDD GJPPK2LBOD">
</tr>
<tr class="GJPPK2LBCE" __gwt_subrow="0" __gwt_row="1">
<td class="GJPPK2LBBD GJPPK2LBDE GJPPK2LBED">
<div __gwt_cell="cell-gwt-uid-684" style="outline-style:none;">
<input type="checkbox" tabindex="-1"/>
</div>
</td>
<td class="GJPPK2LBBD GJPPK2LBDE">
<div __gwt_cell="cell-gwt-uid-685" style="outline-style:none;">
<span>
<input type="text" tabindex="-1" value="filter2"/>
</span>
<span>
<div style="color:red;font-style:italic;"/>
</span>
</div>
</td>
<td class="GJPPK2LBBD GJPPK2LBDE GJPPK2LBOD">
</tr>
</tbody>
<tbody style="display: none;">
<tfoot style="display: none;" aria-hidden="true"/>
</table>
Thanks,
Riaz
//table[#id="reporting_add_report_tab_manual_ct_match_filters"]/tbody/tr/td//input[#value!="filter2"][contains(#value,"filter")]
I have a page with this basic process:
Click checkboxes next to forms you want to download
Click submit
CFWindow pops up to collect some basic info
Click submit to download forms while staying in the window that was opened by CFWindow
When you click the submit button inside the CFWindow , it brings you back to the parent page. I want the form submission to stay inside the CFWindow. I saw this post: Refresh cfwindow content. However, the refreshOnShow = "true" does not work. Every time I hit submit, it goes back to the parent window.
Here is the Parent page:
<cfform name="myform">
<cfinput type="hidden" name="OrgID" value="#getit.orgID#">
<table width="95%" border="0" cellspacing="5" cellpadding="0" align="center">
<tr>
<td width="50%" valign="top" class="coretextforBR">
<cfinput type="checkbox" name="GetThese" value="#form_ID#">
<a class="corelinkforBR">#Forms_Name#</a>
<br /><br />
#Forms_Description#
<br /><br />
</td>
</tr>
<tr>
<td width="50%" valign="top" class="coretextforBR">
<cfinput type="checkbox" name="GetThese" value="#form_ID#">
<a class="corelinkforBR">#Forms_Name#</a>
<br /><br />
#Forms_Description#
<br /><br />
</td>
</tr>
<tr>
<td width="50%" valign="top" class="coretextforBR">
<cfinput type="checkbox" name="GetThese" value="#form_ID#">
<a class="corelinkforBR">#Forms_Name#</a>
<br /><br />
#Forms_Description#
<br /><br />
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit"value="Get It" onclick="javascript:ColdFusion.Window.show('mywindow1')">
</td>
</tr>
</table>
</cfform>
<cfwindow x="250" y="250" width="400" height="400"
name="mywindow1" title="Almost ready to download" initshow="false" draggable="false" resizable="false"
refreshOnShow="true" source="submitform.cfm?GetThese={myform:GetThese.value}&OrgID={myform:OrgID}&action=information"
bodystyle="background-color: white;" headerStyle="background-color: ###getcss.color#; font-family: #getcss.font#; color: ###getcss.fontcolor#;" />
Here is the source (submit.cfm) for the CFWwindow:
<cfparam name="attributes.action" default="information">
<cfoutput>
<html>
<head>
<style type="text/css">
</style>
</head>
<body>
This window will collect information to begin download
<br>
<!--- action for downloading --->
<cfif attributes.action eq "download">
<cfloop info and stuff left out>
#Forms_Name#<br />
</cfloop>
<!--- what you see when page initially loads --->
<cfelse>
<form action="submitform.cfm?action=download" method="post">
<input type="hidden" name="GetThese" value="#attributes.GetThese#">
<input type="hidden" name="OrgID" value="#attributes.OrgID#">
<table width="95%" border="0" align="center">
<tr>
<td class="coretextforBR">First:</td>
<td><input type="text" name="CollectedInfo_First"></td>
</tr>
<tr>
<td class="coretextforBR">Last:</td>
<td><input type="text" name="CollectedInfo_Last"></td>
</tr>
<tr>
<td class="coretextforBR">Phone:</td>
<td><input type="text" name="CollectedInfo_Phone"></td>
</tr>
<tr>
<td class="coretextforBR">Email:</td>
<td><input type="text" name="CollectedInfo_Email"></td>
</tr>
<tr>
<td class="coretextforBR">Best way <br> to contact:</td>
<td><input type="text" name="CollectedInfo_BestWay"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Download" class="button one"></td>
</tr>
</table>
</form>
</cfif>
</cfoutput>
</body>
</html>
I have no idea what I am doing wrong. I couldn't find a definite answer to my problem either other than the refreshOnShow. Should I rethink and do a ajax submit?
Using <cfform> instead of normal <form> worked as Liegh suggested.
I have a table with 4 rows. There is a checkbox in the first column for each row. 4 checkboxes as there are 4 rows. A checkbox for Name, Address, DOB, Phone
I want to select all of the checkboxes. My code does this as I can see the checkboxes being ticked when i run my Selenium Python code.
When all checkboxes are ticked it throws the error:
StaleElementReferenceException: Message: Element is no longer valid
My code method implentation is as follows:
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
def click_all_variables_from_variables_section(self):
#checkboxes = self.driver.find_elements_by_css_selector("#reporting_add_report_tab_manual_ct_vars_usn input[type='checkbox']")
#checkboxes = WebDriverWait(self.driver, 20).until(EC.presence_of_all_elements_located((By.CSS_SELECTOR, "'#reporting_add_report_tab_manual_ct_vars_usn input[type='checkbox']'")))
checkboxes = self.driver.find_elements(By.XPATH, '//table[#id="reporting_add_report_tab_manual_ct_vars_usn"]//input[#type="checkbox"]')
for checkbox in checkboxes:
checkbox.click()
return self
From my code you can see some comments of what else I have tried e.g. WebDriverWait. When i tried WebDriverWait it stayed stuck in a loop for a very long time. I had to close to the browser to exit.
The HTML is:
<table id="reporting_add_report_tab_manual_ct_vars_usn" class="GLKP2TGBJE" cellspacing="0" __gwtcellbasedwidgetimpldispatchingfocus="true" __gwtcellbasedwidgetimpldispatchingblur="true">
<thead aria-hidden="false">
<colgroup>
<tbody style="">
<tr class="GLKP2TGBCD GLKP2TGBJD" __gwt_subrow="0" __gwt_row="0">
<td class="GLKP2TGBBD GLKP2TGBDD GLKP2TGBED GLKP2TGBKD">
<div __gwt_cell="cell-gwt-uid-488" style="outline-style:none;">
<input type="checkbox" tabindex="-1" />
</div>
</td>
<td class="GLKP2TGBBD GLKP2TGBDD GLKP2TGBKD">
<div __gwt_cell="cell-gwt-uid-489" style="outline-style:none;">Name</div>
</td>
<td class="GLKP2TGBBD GLKP2TGBDD GLKP2TGBKD">
<div __gwt_cell="cell-gwt-uid-490" style="outline-style:none;">
<select tabindex="-1">
<option selected="selected" value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
</div>
</td>
<td class="GLKP2TGBBD GLKP2TGBDD GLKP2TGBKD">
<div __gwt_cell="cell-gwt-uid-491" style="outline-style:none;">
<select tabindex="-1">
<option selected="selected" value="" />
</select>
</div>
</td>
<td class="GLKP2TGBBD GLKP2TGBDD GLKP2TGBOD GLKP2TGBKD">
<div __gwt_cell="cell-gwt-uid-492" style="outline-style:none;">
<input type="text" tabindex="-1" value="" />
</div>
</td>
</tr>
<tr class="GLKP2TGBCE" __gwt_subrow="0" __gwt_row="1">
<td class="GLKP2TGBBD GLKP2TGBDE GLKP2TGBED">
<div __gwt_cell="cell-gwt-uid-488" style="outline-style:none;">
<input type="checkbox" tabindex="-1" />
</div>
</td>
<td class="GLKP2TGBBD GLKP2TGBDE">
<div __gwt_cell="cell-gwt-uid-489" style="outline-style:none;">Address</div>
</td>
<td class="GLKP2TGBBD GLKP2TGBDE">
<div __gwt_cell="cell-gwt-uid-490" style="outline-style:none;">
<select tabindex="-1">
</div>
</td>
<td class="GLKP2TGBBD GLKP2TGBDE">
<div __gwt_cell="cell-gwt-uid-491" style="outline-style:none;">
<select tabindex="-1">
<option selected="selected" value="" />
</select>
</div>
</td>
<td class="GLKP2TGBBD GLKP2TGBDE GLKP2TGBOD">
<div __gwt_cell="cell-gwt-uid-492" style="outline-style:none;">
<input type="text" tabindex="-1" value="" />
</div>
</td>
</tr>
<tr class="GLKP2TGBCD" __gwt_subrow="0" __gwt_row="2">
<td class="GLKP2TGBBD GLKP2TGBDD GLKP2TGBED">
<div __gwt_cell="cell-gwt-uid-488" style="outline-style:none;">
<input type="checkbox" tabindex="-1" />
</div>
</td>
<td class="GLKP2TGBBD GLKP2TGBDD">
<div __gwt_cell="cell-gwt-uid-489" style="outline-style:none;">DOB</div>
</td>
<td class="GLKP2TGBBD GLKP2TGBDD">
<div __gwt_cell="cell-gwt-uid-490" style="outline-style:none;">
<select tabindex="-1">
</div>
</td>
<td class="GLKP2TGBBD GLKP2TGBDD">
<div __gwt_cell="cell-gwt-uid-491" style="outline-style:none;">
<select tabindex="-1">
<option selected="selected" value="" />
</select>
</div>
</td>
<td class="GLKP2TGBBD GLKP2TGBDD GLKP2TGBOD">
<div __gwt_cell="cell-gwt-uid-492" style="outline-style:none;">
<input type="text" tabindex="-1" value="" />
</div>
</td>
</tr>
<tr class="GLKP2TGBCE" __gwt_subrow="0" __gwt_row="3">
<td class="GLKP2TGBBD GLKP2TGBDE GLKP2TGBED">
<div __gwt_cell="cell-gwt-uid-488" style="outline-style:none;">
<input type="checkbox" tabindex="-1" />
</div>
</td>
<td class="GLKP2TGBBD GLKP2TGBDE">
<div __gwt_cell="cell-gwt-uid-489" style="outline-style:none;">Phone</div>
</td>
<td class="GLKP2TGBBD GLKP2TGBDE">
<div __gwt_cell="cell-gwt-uid-490" style="outline-style:none;">
<select tabindex="-1">
</div>
</td>
<td class="GLKP2TGBBD GLKP2TGBDE">
<div __gwt_cell="cell-gwt-uid-491" style="outline-style:none;">
<select tabindex="-1">
<option selected="selected" value="" />
</select>
</div>
</td>
<td class="GLKP2TGBBD GLKP2TGBDE GLKP2TGBOD">
<div __gwt_cell="cell-gwt-uid-492" style="outline-style:none;">
<input type="text" tabindex="-1" value="" />
</div>
</td>
</tr>
</tbody>
<tbody style="display: none;">
<tr>
<td align="center" colspan="5">
<div>
<div style="width: 100%; height: 100%; padding: 0px; margin: 0px; display: none;" aria-hidden="true">
<div style="width: 100%; height: 100%; display: none;" aria-hidden="true">
<div class="gwt-Label">No data to display.</div>
</div>
</div>
<div style="width: 100%; height: 100%; padding: 0px; margin: 0px;" aria-hidden="false">
<div class="GLKP2TGBBE" style="width: 100%; height: 100%;" aria-hidden="false">
<div class="gwt-Label">Loading...</div>
</div>
</div>
</div>
</td>
</tr>
</tbody>
<tfoot style="" aria-hidden="false">
</table>
The full error trace is:
Traceback (most recent call last):
File "C:\Webdriver\ClearCore\TestCases\ReportingPage_TestCase.py", line 53, in test_add_matches_report
reports_page.click_all_variables_from_variables_section()
File "C:\Webdriver\ClearCore\Pages\reports.py", line 75, in click_all_variables_from_variables_section
checkbox.click()
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 65, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 402, in _execute
return self._parent.execute(command, params)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 175, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 166, in check_response
raise exception_class(message, screen, stacktrace)
StaleElementReferenceException: Message: Element is no longer valid
I have also tried waiting for the table to load first then click the checkboxes.
My code is:
WebDriverWait(self.driver, 20).until(EC.presence_of_all_elements_located((By.ID, '//table[#id="reporting_add_report_tab_manual_ct_vars_usn"]')))
checkboxes = self.driver.find_elements(By.XPATH, '//table[#id="reporting_add_report_tab_manual_ct_vars_usn"]//input[#type="checkbox"]')
for checkbox in checkboxes:
checkbox.click()
This one throws a TimeoutException
How can i solve this, click all of the checkboxes without there being any errors?
Thanks,
Riaz
I have a simple related selects issue. I have a cfdiv bound to a cfm with a select input.
The selects "work" properly in that you select a category from the first select and it changes the second select's values. But spec_id is not in the form post.
This is probably something simple. Ideas?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>CFDiv Test</title>
</head>
<body>
<cfset application.dsn = "ASA">
<cfset session.event_id = 14>
<cfif isDefined('form.specSub')>
<cfdump var="#form#"><cfabort>
</cfif>
<cfquery name="getSpecSets" datasource="#application.dsn#">
SELECT S.Setup_ID, S.Setup_Name, S.Event_ID, is_Public, is_standard,
(SELECT COUNT(Set_ID) FROM XR_Spec_Sets WHERE Setup_ID = S.Setup_ID) AS Spec_Count
FROM Spec_Sets S
WHERE S.Event_ID = 0
OR S.Event_ID = <cfqueryparam value="#session.event_ID#" cfsqltype="CF_SQL_INTEGER">
</cfquery>
<cfparam name="attributes.setup_id" default="#getSpecSets.setup_ID#">
<cfquery name="getEditName" datasource="#application.dsn#">
SELECT Setup_Name FROM Spec_Sets WHERE Setup_id = <cfqueryparam value="#val(attributes.setup_ID)#" cfsqltype="CF_SQL_INTEGER">
</cfquery>
<cfquery name="getSpecs" datasource="#application.dsn#">
SELECT XR.*, S.Spec_Name, S.Spec_Cat, S.Event_ID
FROM XR_Spec_Sets XR INNER JOIN Specs S ON XR.Spec_ID = S.Spec_ID
WHERE XR.Set_ID = <cfqueryparam value="#val(attributes.setup_ID)#" cfsqltype="CF_SQL_INTEGER">
</cfquery>
<cfquery name="getSpecCats" datasource="#application.dsn#">
SELECT Distinct(Spec_Cat) AS Spec_Cat
FROM Specs
ORDER BY Spec_Cat DESC
</cfquery>
<script>
function specSel(id) {
url = "div_specs.cfm?spec_cat=" + id;
ColdFusion.navigate(url,'spec_sel');
}
</script>
<cfoutput>
<table width="95%" align="center" cellspacing="5" border="0">
<tr>
<td width="50%">
<table cellpadding="3" width="100%" cellspacing="1" class="form">
<tr><td colspan="7" class="page_subTitle">Spec Sets</td></tr>
<tr>
<td class="grid_head">Set ID</td>
<td class="grid_head">Set Name</td>
<td class="grid_head">Event</td>
<td class="grid_head">Public</td>
<td class="grid_head">Standard</td>
<td class="grid_head" align="center">Edit</td>
<td class="grid_head" align="center">Delete</td>
</tr>
<form action="cfdivtest.cfm" method="post" name="specForm" id="specForm">
<tr>
<td class="grid_row_alt" align="center">*</td>
<td class="grid_row_alt" align="center">
<input type="text" name="setup_name" size="25" maxlength="100" class="small">
</td>
<td class="grid_row_alt" align="center">
<select name="event_IDs" class="small">
<option value="0" SELECTED>All Events</option>
<option value="#session.event_ID#">This Event Only</option>
</select>
</td>
<td class="grid_row_alt" nowrap>
<input type="radio" name="is_Public" value="Yes"> Y<br>
<input type="radio" name="is_Public" value="No" checked> N
</td>
<td class="grid_row_alt" nowrap>
<input type="radio" name="is_standard" value="Yes"> Y<br>
<input type="radio" name="is_standard" value="No" checked> N
</td>
<td class="grid_row_alt" colspan="2" align="center"><input type="submit" name="addForm" value="Add >>" class="small"></td>
</tr>
</form>
<cfloop query="getSpecSets">
<tr <cfif attributes.setup_id EQ getSpecSets.setup_id>style="font-weight:bold;"</cfif>>
<cfif getSpecSets.currentrow MOD 2 EQ 0><cfset class="grid_row_alt"><cfelse><cfset class="grid_row"></cfif>
<td class="#class#" align="center">#getSpecSets.setup_ID#</td>
<td class="#class#">#getSpecSets.Setup_Name#</td>
<td class="#class#"><cfif getSpecSets.event_id Eq 0>All Events<cfelse>This Event</cfif></td>
<td class="#class#" align="center">#getSpecSets.is_public#</td>
<td class="#class#" align="center">#getSpecSets.is_standard#</td>
<td class="#class#" align="center">
</td>
<td class="#class#" align="center">
</td>
</tr>
</cfloop>
</table>
</td>
<td width="50%">
<table cellpadding="3" width="100%" cellspacing="1" class="form">
<tr><td colspan="7" class="page_subTitle">Included Specs - #getEditName.setup_name#</td></tr>
<tr>
<td class="grid_head" width="10%"> </td>
<td class="grid_head" width="30%">Type</td>
<td class="grid_head" width="10%" align="center">Qty</td>
<td class="grid_head" width="30%">Spec</td>
<td class="grid_head" width="10%" align="center">Remove</td>
</tr>
<form action="cfdivtest.cfm?setup_ID=#attributes.setup_ID#" method="post" name="addForm" id="addForm">
<tr>
<td class="grid_row_alt" align="center">*</td>
<td class="grid_row_alt" align="center">
<select name="spec_cat" onchange="specSel(this.value)" class="small">
<cfloop query="getSpecCats">
<option value="#getSpecCats.spec_cat#" <cfif getSpecCats.currentrow EQ 1>SELECTED</cfif>>#getSpecCats.spec_cat#</option>
</cfloop>
</select>
</td>
<td class="grid_row_alt" align="center"><input type="text" name="qty" size="2" value="1" maxlength="6" class="small"></td>
<td class="grid_row_alt" align="center">
<cfdiv id="spec_sel" bind="url:div_specs.cfm?spec_cat=#getSpecCats.spec_cat[1]#"></cfdiv>
</td>
<td class="grid_row_alt" align="center" colspan="2"><input type="submit" name="specSub" class="small" value="Add >>"></td>
</tr>
</form>
<cfif getSpecs.recordcount>
<cfloop query="getSpecs">
<cfif getSpecs.currentrow MOD 2 EQ 0><cfset class="grid_row_alt"><cfelse><cfset class="grid_row"></cfif>
<tr>
<td class="#class#" align="right">#getSpecs.currentrow#. </td>
<td class="#class#">#getSpecs.spec_cat#</td>
<td class="#class#" align="center">#getSpecs.qty#</td>
<td class="#class#">#getSpecs.Spec_Name# (#getSpecs.event_id#)</td>
<td class="#class#" align="center">
</td>
</tr>
</cfloop>
<tr><td colspan="7" align="center"> </td></tr>
<cfelse>
<tr><td colspan="7" align="center"><strong><em>There are no specs assigned.</em></strong></td></tr>
</cfif>
</table>
</td>
</tr>
</table>
</cfoutput>
</body>
</html>
div_specs.cfm
<cfset application.dsn = "ASA">
<cfset session.event_id = 14>
<cfparam name="url.report" default="No">
<cfquery name="getSpecs" datasource="#application.dsn#">
SELECT Spec_name AS Option_Text, Spec_ID AS Option_Value, Event_ID
FROM Specs
WHERE 1 = 1
<cfif url.spec_cat NEQ "All">
AND Spec_Cat = <cfqueryparam value="#url.spec_cat#" cfsqltype="CF_SQL_VARCHAR">
</cfif>
AND (Event_ID = 0 OR Event_ID = <cfqueryparam value="#session.event_ID#" cfsqltype="CF_SQL_INTEGER">)
ORDER BY Spec_name
</cfquery>
<cfoutput>
<select name="spec_id" id="spec_id" class="small">
<cfif url.report EQ "Yes">
<option value="All" selected>All</option>
</cfif>
<cfloop query="getSpecs">
<option value="#getSpecs.option_value#" <cfif getSpecs.currentrow EQ 1 AND url.report EQ "No">SELECTED</cfif>>
#getSpecs.option_text#
</option>
</cfloop>
</select>
</cfoutput>
Your <form> is invalidly nested between </tr><tr>. Move it outside of the <table> tag and it should work fine.
Like this: (note stripped down for clarity)
<table width="95%" align="center" cellspacing="5" border="0">
<tr>
<td width="50%">
<form action="cfdivtest.cfm" method="post" name="specForm" id="specForm">
<table cellpadding="3" width="100%" cellspacing="1" class="form">
<tr><td colspan="7" class="page_subTitle">Spec Sets</td></tr>
<tr>
<td class="grid_head">Set ID</td>
<td class="grid_head">Set Name</td>
<td class="grid_head">Event</td>
<td class="grid_head">Public</td>
<td class="grid_head">Standard</td>
<td class="grid_head" align="center">Edit</td>
<td class="grid_head" align="center">Delete</td>
</tr>
<tr>
<td class="grid_row_alt" align="center">*</td>
<td class="grid_row_alt" align="center">
<input type="text" name="setup_name" size="25" maxlength="100" class="small">
</td>
<td class="grid_row_alt" align="center">
<select name="event_IDs" class="small">
<option value="0" SELECTED>All Events</option>
<option value="#session.event_ID#">This Event Only</option>
</select>
</td>
<td class="grid_row_alt" nowrap>
<input type="radio" name="is_Public" value="Yes"> Y<br>
<input type="radio" name="is_Public" value="No" checked> N
</td>
<td class="grid_row_alt" nowrap>
<input type="radio" name="is_standard" value="Yes"> Y<br>
<input type="radio" name="is_standard" value="No" checked> N
</td>
<td class="grid_row_alt" colspan="2" align="center"><input type="submit" name="addForm" value="Add >>" class="small"></td>
</tr>
</table>
</form>
</td>
</tr>
BTW - DON'T USE CFDIV See https://github.com/cfjedimaster/ColdFusion-UI-the-Right-Way