Hello all!

I have a page with multiple forms on it and they are all using relative addresses in their action lines, but I have a strange discrepancy I cannot figure out.

All of the forms have lines like this.

<form action="indexreport.cfm?fuseaction=casereport" etc. etc.

But one of them has to be coded like this.

<form action="/sales/indexreport.cfm?fuseaction=demoreport" etc. etc.

These forms are all on the same page. I cannot figure out why just this one particular form is needing the directory placed in front and the others are not. It is causing a problem because I tried to move everything to a new directory and now that one form is not working. The others still work.

Here is the whole page.

<cfquery datasource="#datasource#" name="staff">
	SELECT *
	FROM Staff
	WHERE user_type = 2 OR user_type = 3
	ORDER BY area, name_last, name_first
</cfquery>
<cfset alphalist = "A,B,C,D,E,F,G,H,Health,I,J,K,L,M,Memorial,N,O,P,Q,R,S,Select,St,T,U,V,W,X,Y,Z,1,2,3,4,5,6,7,8,9,0">

<script src="includes/lib/prototype.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
	function load_hospitals(letter){
		document.getElementById('hospital_select').style.display = 'none';
		var post_body = 'fuseaction=json_hospitals&hospital_letter='+ letter;
		var url = 'indexreport.cfm';
		new Ajax.Request(url, { parameters:post_body, onSuccess:hospital_handlerFunc, onFailure:errFunc})
	}
	var hospital_handlerFunc = function(t) {
		document.getElementById('hospital_select').innerHTML = t.responseText;
		document.getElementById('hospital_select').style.display = 'inline';	
	}
	var errFunc = function(t) {
		alert('Error ' + t.status + ' -- ' + t.statusText);
	}		
	
</script>
<br />	

<table border="0" cellpadding="0" cellspacing="0" width="90%" align="center"> 
<form action="indexreport.cfm?fuseaction=act_demo_report" method="post" name="demo_form" id="demoForm">	
	 <tr> 
		<td class="formtitle" colspan="10" style="height:18px;">Demo Report</td> 
	</tr> 

		<tr> 
			<td class="formlabel" width="150">Sales Person</td> 
			<td class="formfield">
			<select name="staff_ID">
				<option value="">All Staff</option>
				<cfloop query="staff">
						<cfoutput><option value="#staff.ID#" >#staff.name_last#, #staff.name_first# - #staff.area#</option></cfoutput>
				</cfloop>
			</select>
			</td>
		</tr>
		<tr>
			<td class="formlabel">Sales Area</td> 
			<td class="formfield">
			<select name="area">
				<option value="" >All Areas</option>
				<cfloop from="1" to="#arraylen(TERRITORIES)#" index="i">
					<cfoutput><option value="#TERRITORIES[i]#" >#TERRITORIES[i]#</option></cfoutput>
				</cfloop>
			</select>
			</td>
		</tr>
		<tr>
			<td class="formlabel">Surgeon Specialty</td> 
			<td class="formfield">
			<select name="specialty">
				<option value="">All Specialties</option>
				<option value="Neuro">Neuro</option>
				<option value="Ortho">Ortho</option>
				<option value="Pain Mgnt">Pain Mgnt</option>
			</select>
			</td>
		</tr>
		<tr>
			<td class="formlabel">Discectomies</td> 
			<td class="formfield">
			<select name="disectomies" >
				<option value="" >Any Number</option>
				<option value="0-4" >0-4</option>
				<option value="5-9" >5-9</option>
				<option value="10-14">10-14</option>
				<option value="15-19">15-19</option>
				<option value="20 or more">20 or more</option>
			</select>
			</td>
		</tr>	
		<tr>
			<td class="formlabel">Location/Venue</td> 
			<td class="formfield">
			<select name="location" >
				<option value="" >All Locations</option>
				<option value="Tradeshow" >Tradeshow-All</option>
				<option value="National" >Tradeshow-National</option>
				<option value="Local">Tradeshow-Local</option>
				<option value="Other">Tradeshow-Other</option>
			</select>
			</td>
		</tr>
		<tr>
			<td class="formlabel">Product Demonstrated</td> 
			<td class="formfield">
			<select name="product">
				<option value="">All Demos</option>
				<option value="Inclose">Inclose</option>
				<option value="Xclose">Xclose</option>
				<option value="Both">Both</option>
				<option value="None">None</option>
			</select>
			</td>
		</tr>
		<tr>
			<td class="formlabel">Product Interest</td> 
			<td class="formfield">
			<select name="product_interest">
				<option value="">All Demos</option>
				<option value="Inclose">Inclose</option>
				<option value="Xclose">Xclose</option>
				<option value="Both">Both</option>
				<option value="None">None</option>
			</select>
			</td>
		</tr>
			<tr>
			<td class="formlabel">NTC</td> 
			<td class="formfield">
			<select name="ntc">
				<option value="">Either</option>
				<option value="true">Required</option>
				<option value="false">Not Required</option>
			</select>
			</td>
		</tr>
		<tr>
			<td class="formlabel">Date of Demo (mm/dd/yyyy)</td> 
			<td class="formfield">
			
			<label for="date_start">Start</label>
			<input type="text" id="date_start1" name="date_start" value="<cfoutput>#dateformat(dateadd('m',-1,now()),'mm/dd/yyyy')#</cfoutput>" />	
			<!---<img src="/Scripts/img/cal.gif" width="16" height="16" border="0"  onclick="popup1.setTarget(document.getElementById('date_start1'));" alt="Click Here to Pick up the date">--->
				
			<label for="date_end">End</label>
			<input type="text" id="date_end1" name="date_end" value="<cfoutput>#dateformat(now(),'mm/dd/yyyy')#</cfoutput>" />	
			<!---<img src="/Scripts/img/cal.gif" width="16" height="16" border="0"  onclick="popup2.toggle();" alt="Click Here to Pick up the date">--->
			
			

			</td>
		</tr>
		<tr>
			<td class="formlabel">&nbsp;</td> 
			<td class="formfield"><input type="submit" value="RUN" /></td>
		</tr>
</form>

</table>


<table border="0" cellpadding="0" cellspacing="0" width="90%" align="center"> 
<form action="/sales/indexreport.cfm?fuseaction=act_case_report" method="post" id="case_form" name="case_form">	
	 <tr> 
		<td class="formtitle" colspan="2" style="height:18px;">Case Report</td> 
	</tr> 
		<tr> 
			<td class="formlabel" width="100">Sales Person</td> 
			<td class="formfield">
			<select name="staff_ID">
				<option value="">All Staff</option>
				<cfloop query="staff">
						<cfoutput><option value="#staff.ID#" >#staff.name_last#, #staff.name_first# - #staff.area#</option></cfoutput>
				</cfloop>
			</select>
			</td>
		</tr>
		<tr>
			<td class="formlabel">Sales Area</td> 
			<td class="formfield">
			<select name="area">
				<option value="" >All Areas</option>
				<cfloop from="1" to="#arraylen(TERRITORIES)#" index="i">
					<cfoutput><option value="#TERRITORIES[i]#" >#TERRITORIES[i]#</option></cfoutput>
				</cfloop>
			</select>
			</td>
		</tr>
		<tr> 
			<td class="formlabel">Hospital</td> 
			<td class="formfield" colspan="3">
				<input type="hidden" name="hospital_ID_holder" id="hospital_ID_holder" />
				
				<select name="hospital_letter" onchange="load_hospitals(this.options[this.selectedIndex].value);">
					<option value="">First Letter</option>
					<cfloop list="#alphalist#" index="letter">
						<cfoutput><option value="#letter#" >#letter#</option></cfoutput>
					</cfloop>
					<option value="">Full List</option>
				</select>
				<div id="hospital_select" style="display:inline;">
				<select name="hospital_ID" onchange="$('hospital_ID_holder').value = this.options[this.selectedIndex].value;">
					<option value="">All Hospitals</option>
				</select>
				</div>
				
			</td> 
		</tr>
		<tr>
			<td class="formlabel">Surgeon Specialty</td> 
			<td class="formfield">
			<select name="specialty">
				<option value="">All Specialties</option>
				<option value="Neuro">Neuro</option>
				<option value="Ortho">Ortho</option>
				<option value="Pain Mgnt">Pain Mgnt</option>
			</select>
			</td>
		</tr>
		<!---<tr>
			<td class="formlabel">Discectomies</td> 
			<td class="formfield">
			<select name="disectomies" >
				<option value="" >Any Number</option>
				<option value="0-4" >0-4</option>
				<option value="5-9" >5-9</option>
				<option value="10-14">10-14</option>
				<option value="15-19">15-19</option>
				<option value="20 or more">20 or more</option>
			</select>
			</td>
		</tr>	--->
		<tr>
			<td class="formlabel">Product Used (Successful)</td> 
			<td class="formfield">
			<select name="product">
				<option value="">All Products</option>
				<option value="Inclose">Inclose</option>
				<option value="Xclose">Xclose</option>
			</select>
			</td>
		</tr>
		<tr>
			<td class="formlabel">Product Intended for Use (Unsuccessful)</td> 
			<td class="formfield">
			<select name="product_intended">
				<option value="">All Products</option>
				<option value="Inclose">Inclose</option>
				<option value="Xclose">Xclose</option>
				<option value="Either">Either</option>
			</select>
			</td>
		</tr>
		<tr>
			<td class="formlabel">Successful</td> 
			<td class="formfield">
			<select name="outcome_successful">
				<option value="">Either</option>
				<option value="true">Go</option>
				<option value="false">No Go</option>
			</select>
			</td>
		</tr>
		<tr> 
			<td class="formlabel">Was an Anulotomy Performed</td> 
			<td class="formfield">
				<select name="anulotomy">
					<option value="">All Options</option>
					<option value="None">No Anulotomy Performed</option>
					<option value="Slit" >Slit</option>
					<option value="Box Window">Box Window</option>
					<option value="Cruciate">Cruciate</option>
					<option value="Other">Other</option>
				</select>
			</td> 
		</tr>
		<tr>
			<td class="formlabel">Charge</td> 
			<td class="formfield">
			<select name="charge">  
				<option value="">Either</option>
				<option value="yes">Yes</option>
				<option value="no">No</option>    			
			</select>
			</td>
		</tr>
		<tr>
			<td class="formlabel">Patient Case Type</td> 
			<td class="formfield">
			<select name="case_type">
				<option value="">All Case Types</option>
				<option value="1st Surgery">1st Surgery</option>
				<option value="ReOp-Same Level and Site">ReOp-Same Level and Site</option>
				<option value="ReOp-Different Level or Site">ReOp-Different Level or Site</option>
			</select>
			</td>
		</tr>
		<tr>
			<td class="formlabel">Date of Surgery (mm/dd/yyyy)</td> 
			<td class="formfield">
			<!---Start<input type="text" name="date_start" value="<cfoutput>#dateformat(dateadd('m',-1,now()),'mm/dd/yyyy')#</cfoutput>" />&nbsp;&nbsp;&nbsp;
			End<input type="text" name="date_end" value="<cfoutput>#dateformat(now(),'mm/dd/yyyy')#</cfoutput>" />--->
			Start <input type="Text" name="date_start" value="<cfoutput>#dateformat(dateadd('m',-1,now()),'mm/dd/yyyy')#</cfoutput>">
			<!---<a href="javascript:case_date_start.popup();"><img src="/Scripts/img/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a>--->&nbsp;&nbsp;&nbsp;
			End <input type="Text" name="date_end" value="<cfoutput>#dateformat(dateadd('m',0,now()),'mm/dd/yyyy')#</cfoutput>">
			<!---<a href="javascript:case_date_start.popup();"><img src="/Scripts/img/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date"></a>--->
			
			</td>
		</tr>
		<tr>
			<td class="formlabel">&nbsp;</td> 
			<td class="formfield"><input type="submit" value="RUN" /><input style="display:none;" type="button" name="btnCaseOrig" id="btnCaseOrig" onclick="setCaseActionOld();" value="Run Old" /></td>
		</tr>
</form>
<script language="JavaScript">
<!-- // create calendar object(s) just after form tag closed
	 // specify form element as the only parameter (document.forms['formname'].elements['inputname']);
	var case_date_start = new calendar2(document.forms['case_form'].elements['date_start']);
	if(!case_date_start){ alert('here'); }
	case_date_start.year_scroll = false;
	case_date_start.time_comp = false;
	var case_date_end = new calendar2(document.forms['case_form'].elements['date_end']);
	case_date_end.year_scroll = false;
	case_date_end.time_comp = false;
//-->
</script>
</table>


<table border="0" cellpadding="0" cellspacing="0" width="90%" align="center"> 
<form action="indexreport.cfm?fuseaction=act_hospital_report" method="post">	
	 <tr> 
		<td class="formtitle" colspan="10" style="height:18px;">Hospital Report</td> 
	</tr> 
		<tr> 
			<td class="formlabel" width="150">Sales Person</td> 
			<td class="formfield">
			<select name="staff_ID">
				<option value="">All Staff</option>
				<cfloop query="staff">
						<cfoutput><option value="#staff.ID#" >#staff.name_last#, #staff.name_first# - #staff.area#</option></cfoutput>
				</cfloop>
			</select>
			</td>
		</tr>
		<tr>
			<td class="formlabel">Area</td> 
			<td class="formfield">
			<select name="area">
				<option value="" >All Areas</option>
				<cfloop from="1" to="#arraylen(TERRITORIES)#" index="i">
					<cfoutput><option value="#TERRITORIES[i]#" >#TERRITORIES[i]#</option></cfoutput>
				</cfloop>
			</select>
			</td>
		</tr>
		<tr>
			<td class="formlabel">&nbsp;</td> 
			<td class="formfield"><input type="submit" value="RUN" /></td>
		</tr>
</form>
</table>

<table border="0" cellpadding="0" cellspacing="0" width="90%" align="center"> 
<form action="indexreport.cfm?fuseaction=act_surgeon_report" method="post">	
	 <tr> 
		<td class="formtitle" colspan="10" style="height:18px;">Surgeon Report</td> 
	</tr> 
		<tr> 
			<td class="formlabel" width="150">Sales Person</td> 
			<td class="formfield">
			<select name="staff_ID">
				<option value="">All Staff</option>
				<cfloop query="staff">
						<cfoutput><option value="#staff.ID#" >#staff.name_last#, #staff.name_first# - #staff.area#</option></cfoutput>
				</cfloop>
			</select>
			</td>
		</tr>
		<tr>
			<td class="formlabel">Area</td> 
			<td class="formfield">
			<select name="area">
				<option value="" >All Areas</option>
				<cfloop from="1" to="#arraylen(TERRITORIES)#" index="i">
					<cfoutput><option value="#TERRITORIES[i]#" >#TERRITORIES[i]#</option></cfoutput>
				</cfloop>
			</select>
			</td>
		</tr>
		<tr>
			<td class="formlabel">Specialty</td> 
			<td class="formfield">
			<select name="specialty">
				<option value="">All Specialties</option>
				<option value="Neuro">Neuro</option>
				<option value="Ortho">Ortho</option>
				<option value="Pain Mgnt">Pain Mgnt</option>
			</select>
			</td>
		</tr>
		<tr>
			<td class="formlabel">&nbsp;</td> 
			<td class="formfield"><input type="submit" value="RUN" /></td>
		</tr>
</form>
</table>

I am a bit confused by your original description. You say that all of the forms action attributes use relative urls. The action below is most definitely not a relative url.

<form action="/sales/indexreport.cfm?fuseaction=demoreport" etc. etc.

When you put a leading slashie (ie /sales/indexreport.cfm? as opposed to sales/indexreport.cfm) the browser interprets that as an absolute url. The above action attribute is the same as inputting http://www.YOURDOMAINHERE.com/sales/indexreport.cfm?.

Ok, sorry. I see how that works now. That absolute URL is my problem. All 5 forms on the page are pointing to the same action page. 4 of the forms use relative URLs and work fine. But for some reason just that one form is needing an absolute URL and I cannot figure out why.

Note: This is a problem because when I switch the whole sales site from /sales/ to /salesbeta/ for testing work the 4 relative forms still work fine but the absolute URL form stops working, even though I have switched the designation from /sales/ to /salesbeta/ in the form.

Here is some more info.

Ok

The page I posted above is dsp_reports.cfm. This page gets included into index.cfm. index.cfm and indexreport.cfm are both in the Sales directory. So it makes sense that the 4 forms that use relative URLs work. But for some reason the one form needs to have /sales/ in front of it to work. If I remove /sales/ from that one form I get a page load error like this.

Firefox can't find the file at http://www.mysite.com/sales/indexreport.cfm?fuseaction=act_case_report.

IE gets a similar error just worded differently.

If I run this form with the /sales/ in front I get this. (and it works)

http://www.mysite.com/sales/indexreport.cfm?fuseaction=act_case_report.

When I run either of the other 4 forms that work with the relative URLs (demo for example) the URL looks like this.

http://www.mysite.com/sales/indexreport.cfm?fuseaction=act_demo_report.

So you can see the 4 forms using the relative addys make the same URL as the one using the absolute URL. But as far as I can tell the one using the absolute URL should be able to work without /sales/ in front as a relative URL just like the other 4 forms.

As for the RUN OLD button that actually does not show up on the page. Maybe because of this? style="display:none
Only the RUN button is displayed which appears to be a normal RUN button just like the other forms.

If I move this whole menagerie to another folder, say /salesbeta/ all 4 of the relative forms still work fine but the form that has the absolute URL stops working even if I have the /sales/ changed to /salesbeta/ on it's action line. That particular form ONLY works when /sales/ is in front. Cannot figure out why.

What is different about that form that is not making it work like the other 4?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.