• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 247
  • Last Modified:

Submitting a value through URL

I usually can do this, but I'm alittle stumped when it's coming from a form..
I'm submitting a form to itself and want the New variable to pass through the URL...

I need EmployeesID, depending on what employee I pick to pass via URL....

<CFFORM ACTION="EmployeeTimeSheet2.cfm?EmployeesID=#FORM.EmployeesID#&M=#URL.M#" METHOD="POST">

<SELECT NAME="SelectE" SIZE="5">
<CFOUTPUT QUERY="listemployees">
<OPTION VALUE="#EmployeesID#">#Firstname# #Lastname#</OPTION>
</CFOUTPUT>
</SELECT>
0
rurth24
Asked:
rurth24
  • 3
  • 2
1 Solution
 
mrichmonCommented:
use method = get  instead of post.  But note you cannot use method = get with CFform in CF 6 (don't know about 7).

You you would need a regular HTML form tag.
0
 
Renante EnteraSenior PHP DeveloperCommented:
Hi rurth24!

I agree with mrichmon but the problem on using method = get is that you will see numerious values of form fields on your URL.

If you only want to pass the value of "FORM.EmployeesID" then you may do it in this manner :

<script language="javascript">
function submitEntry()
{
  var empID = document.form1.SelectE.value;

  document.form1.action = 'EmployeeTimeSheet2.cfm?EmployeesID='+empID+'&M=<cfoutput>#URL.M#</cfoutput>';
  document.form1.submit();
}
</script>

<cfparam name="URL.EmployeesID" default="">

<FORM NAME="form1" ACTION="" METHOD="POST">
  <SELECT NAME="SelectE" SIZE="5" ONCHANGE="submitEntry();">
    <CFOUTPUT QUERY="listemployees">
      <OPTION VALUE="#EmployeesID#" <cfif URL.EmployeesID EQ EmployeesID>SELECTED</cfif>>#Firstname# #Lastname#</OPTION>
    </CFOUTPUT>
  </SELECT>
</FORM>

Hope this helps you.  Just try it.


Goodluck!
eNTRANCE2002 :-)
0
 
rurth24Author Commented:
The GET worked great... I'm getting a TSsubmit=Submit in my URL. It's not a problem but just curious if that's standard?
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
rurth24Author Commented:
Hey I'm working on this query... What I need is it to only display the info related to the EmployeesID
URL.M is so the info is also displayed by month. As of now It's displaying all the values in the field multiple times for each employee...

<CFQUERY name="listhours"
     datasource="#Request.MainDSN#">
SELECT Timesheets.EmployeesID, Timesheets.HSPENT, Timesheets.CLientID, Timesheets.ddate, Clients.CompanyN, Clients.ClientID, Employees.firstname, Employees.lastname, Employees.EmployeesID FROM Timesheets, Clients, Employees WHERE Timesheets.ClientID = Clients.ClientID and Timesheets.EmployeesID = #URL.EmployeesID#
<CFIF isdefined("url.m")>
  and month(ddate) = #url.m#
</CFIF>
</CFQUERY>


<TD WIDTH="838" COLSPAN="8" ALIGN="RIGHT" CLASS="error" ><CFOUTPUT><A HREF="EmployeeTimeSheet2.cfm?EmployeesID=#URL.EmployeesID#&m=1"></CFOUTPUT>
                  <CFIF URL.M is 1>
                    <SPAN CLASS="linkcolor">January</SPAN>
                    <CFELSE>
                    January
                  </CFIF>
                  </A> | <CFOUTPUT><A HREF="EmployeeTimeSheet2.cfm?EmployeesID=#URL.EmployeesID#&m=2"></CFOUTPUT>
                  <CFIF URL.M is 2>
                    <SPAN CLASS="linkcolor">Feburary</SPAN>
                    <CFELSE>
                    Feburary
                  </CFIF>
                  </A> | <CFOUTPUT><A HREF="EmployeeTimeSheet2.cfm?EmployeesID=#URL.EmployeesID#&m=3"></CFOUTPUT>
                  <CFIF URL.M is 3>
                    <SPAN CLASS="linkcolor">March</SPAN>
                    <CFELSE>
                    March
                  </CFIF>
                  </A> | <CFOUTPUT><A HREF="EmployeeTimeSheet2.cfm?EmployeesID=#URL.EmployeesID#&m=4"></CFOUTPUT>
                  <CFIF URL.M is 4>
                    <SPAN CLASS="linkcolor">April</SPAN>
                    <CFELSE>
                    April
                  </CFIF>
                  </A> | <CFOUTPUT><A HREF="EmployeeTimeSheet2.cfm?EmployeesID=#URL.EmployeesID#&m=5"></CFOUTPUT>
                  <CFIF URL.M is 5>
                    <SPAN CLASS="linkcolor">May</SPAN>
                    <CFELSE>
                    May
                  </CFIF>
                  </A> | <CFOUTPUT><A HREF="EmployeeTimeSheet2.cfm?EmployeesID=#URL.EmployeesID#&m=6"></CFOUTPUT>
                  <CFIF URL.M is 6>
                    <SPAN CLASS="linkcolor">June</SPAN>
                    <CFELSE>
                    June
                  </CFIF>
                  </A> | <CFOUTPUT><A HREF="EmployeeTimeSheet2.cfm?EmployeesID=#URL.EmployeesID#&m=7"></CFOUTPUT>
                  <CFIF URL.M is 7>
                    <SPAN CLASS="linkcolor">July</SPAN>
                    <CFELSE>
                    July
                  </CFIF>
                  </A> | <CFOUTPUT><A HREF="EmployeeTimeSheet2.cfm?EmployeesID=#URL.EmployeesID#&m=8"></CFOUTPUT>
                  <CFIF URL.M is 8>
                    <SPAN CLASS="linkcolor">August</SPAN>
                    <CFELSE>
                    August
                  </CFIF>
                  </A> | <CFOUTPUT><A HREF="EmployeeTimeSheet2.cfm?EmployeesID=#URL.EmployeesID#&m=9"></CFOUTPUT>
                  <CFIF URL.M is 9>
                    <SPAN CLASS="linkcolor">September</SPAN>
                    <CFELSE>
                    September
                  </CFIF>
                  </A> | <CFOUTPUT><A HREF="EmployeeTimeSheet2.cfm?EmployeesID=#URL.EmployeesID#&m=10"></CFOUTPUT>
                  <CFIF URL.M is 10>
                    <SPAN CLASS="linkcolor">October</SPAN>
                    <CFELSE>
                    October
                  </CFIF>
                  </A> | <CFOUTPUT><A HREF="EmployeeTimeSheet2.cfm?EmployeesID=#URL.EmployeesID#&m=11"></CFOUTPUT>
                  <CFIF URL.M is 11>
                    <SPAN CLASS="linkcolor">November</SPAN>
                    <CFELSE>
                    November
                  </CFIF>
                  </A> | <CFOUTPUT><A HREF="EmployeeTimeSheet2.cfm?EmployeesID=#URL.EmployeesID#&m=12"></CFOUTPUT>
                  <CFIF URL.M is 12>
                    <SPAN CLASS="linkcolor">December</SPAN>
                    <CFELSE>
                    December
                  </CFIF>
                  </A></TD>
0
 
mrichmonCommented:
This should be a separate question.
0
 
rurth24Author Commented:
MRICHMON think you could take a look at this question...

Not getting much help

http://www.experts-exchange.com/Web/WebDevSoftware/ColdFusion/Q_21386360.html

Thanks...
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now