House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

CFFORM with method="GET"?

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
James
03/06/2003 04:45 PM

Hello Everyone, I'm trying to use CFFORM with method="GET" I need to pass my form variables via the URL but it seems to be working like a POST. My Code: <cfform name = "Search" action = "action.cfm" method="GET"> If I get rid of the CFFORM and use a regular FORM it works. Any ideas? Regards, James Blaha

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Bud
03/06/2003 06:20 PM

On 3/6/03, James penned: >I'm trying to use CFFORM with method="GET" I need to pass my form >variables via the URL but it seems to be working like a POST. CFFORM automatically adds method=POST. -- Bud Schneehagen - Tropical Web Creations _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ ColdFusion Solutions / eCommerce Development buddy@twcreations.com http://www.twcreations.com/ http://www.cf-ezcart.com/ 954.721.3452

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
James Blaha
03/06/2003 05:21 PM

Everett, Does that mean I'm stuck with using the regular FORM tag? Regards, JB

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dave Watts
03/06/2003 05:14 PM

> I'm trying to use CFFORM with method="GET" I need to pass > my form variables via the URL but it seems to be working > like a POST. Straight from the docs: "The method attribute is automatically set to post; if you specify a value, it is ignored." So, if you must send data via the URL, you'll probably want to use a regular HTML form. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Everett, Al
03/07/2003 06:51 AM

> Everett, Does that mean I'm stuck with using the regular FORM tag? I wouldn't consider it being "stuck." I stay far away from CFFORM. I much prefer to roll my own validation routines.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
James Blaha
03/07/2003 08:35 AM

CFFORM Workaround to achieve URL variables in a METHOD = "GET" Simulation. Unfortunately the CFFORM tag does not support the attribute for METHOD. The default METHOD is POST this email has the information for a workaround if you still want to use CFFORM without having to use a regular FORM tags and write out all the JavaScript for field validation. 1. Form page that pass’s all the variables needs to be setup with all the proper “cfparam" tags for all the fields being used. Data will be sending to an intermediate conversion template for the POSTED variables. (A. Sending Template with your CFFORM) <!--- Note: There are 10 search options available. ---> <!--- 1. --->  <cfparam name="ReqNo"     default=""> <!--- 2. --->  <cfparam name="FirstName"     default=""> <!--- 3. --->  <cfparam name="LastName"     default=""> 2. Intermediate Template: This template needs to capture all the variables and pass them using a CFLOCATION tag which will automatically pass the variables to the desired location e.g. a dynamic query search page via the URL. This template doesn’t need anything fancy and at minimal without error handling the code below will achieve the desired results. (B. Intermediate Template) <CFOUTPUT> <CFLOCATION URL="ResultSet.cfm?ReqNo=#TRIM(urlencodedformat(FORM.ReqNo))#&FirstName=#TRIM(urlencodedformat(FORM.FirstName))#&LastName=#TRIM(urlencodedformat(FORM.LastName))#&ApplicationType=#TRIM(urlencodedformat(FORM.ApplicationType))#&Status=#TRIM(urlencodedformat(FORM.Status))#&APPLIED_DATE=#TRIM(urlencodedformat(FORM.APPLIED_DATE))#&Desired_Position=#TRIM(urlencodedformat(FORM.Desired_Position))#&SalaryExpectedYR=#TRIM(urlencodedformat(FORM.SalaryExpectedYR))#&ApplicantStatus=#TRIM(urlencodedformat(FORM.ApplicantStatus))#&HR_Results=#TRIM(urlencodedformat(FORM.HR_Results))#&UserRights=#TRIM(urlencodedformat(FORM.UserRights))#"> </CFOUTPUT> 3. One modification to the receiving template, at the beginning you may want to convert your URL to FORM variables if you’re using a dynamic loop to pass those values to a next template or your test code is just using FORM variables. (C. Dynamic Query Template) <!--- Note: There are 10 search options available. ---> <!--- 1. --->  <CFSET FORM.ReqNo  = URL.ReqNo> <!--- 2. --->  <CFSET FORM.FirstName  = URL.FirstName> <!--- 3. --->  <CFSET FORM.LastName  = URL.LastName> 4. Why all the trouble you ask? If a dynamic query template is being used to output items where you may want to have the option to delete or modify an observation of the output upon that event if you reload the referring page from your action page IE will prompt the user with a security alert. This is the bypass around this IE bug. (D. Action Template) SQL DELETE FROM IMAIL_EMAIL WHERE ID = ‘#FORM.GERRY#’…. <!--- Note: The opener option will refresh the referring pages result set. --->   <script>     opener.location.reload();   </script> Below is my best try at a visual to this example where  “A” is a search CFFORM that submits to the Intermediate Template “B” which then relocates and coverts the FORM variables to URL variables to a Dynamic Query Template “C.” Then if the user selects a action page to e.g. delete or modify you then open a new window and run your Action Template “D” which then refresh “C.” Framed Page Setup ************ * A  |  B  & C * ************ **** * D * **** I hope this helps if you ever run into this issue. It’s a basic web application trick but it caused me some pain & loss if time to learn the hard way. When you really need to use METHOD= “GET” I would say its best to just use FORM tags and the JS then all this information means nothing. Regards, James Blaha


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

March 20, 2010

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
   1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31