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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4