ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 16th, 2005, 07:07 AM
cootjealweer1 cootjealweer1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 28 cootjealweer1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 38 m 59 sec
Reputation Power: 0
Retrieve form value from insert (post method - multipart form data) record

Hi,

I've got an insert record page that use the post method - multipart form data and i want to retrieve the formvalues on the redirect page.

I tried several things, just #form.fieldname# and also with the request command, what's the proper way to do this?

Can anyone help?


Reply With Quote
  #2  
Old September 16th, 2005, 08:22 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,689 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 16 h 33 m 51 sec
Reputation Power: 53
If you have a form field called firstName and you post it, on the action page you reference that value as #form.firstName#.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old September 16th, 2005, 09:22 AM
cootjealweer1 cootjealweer1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 28 cootjealweer1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 38 m 59 sec
Reputation Power: 0
On the insert record page i have this form element:

<input name="checkbox" type="checkbox" class="invoervelden" value="checkbox" checked>

This is a piece of code from the action page:

<cfoutput>
<form action="#CurrentPage#?#CGI.QUERY_STRING#" name="form1" method="POST">
------------------------------------------------------
<input name="checkbox" type="hidden" id="checkbox" value="#form.checkbox#">
------------------------------------------------------
<input type="hidden" name="MM_UpdateRecord" value="form1">
</form></cfoutput>

When i try to run this i get the following error:
------------------------------------------------------
Element CHECKBOX is undefined in FORM.


The error occurred in C:\data\websites\spiriloged\pages\updatebermail.cfm: line 73

71 : <cfoutput>
72 : <form action="#CurrentPage#?#CGI.QUERY_STRING#" name="form1" method="POST">
73 : <input name="checkbox" type="hidden" id="checkbox" value="#form.checkbox#">
74 : <input type="hidden" name="MM_UpdateRecord" value="form1">
75 : </form></cfoutput>

What do i do wrong?

Reply With Quote
  #4  
Old September 16th, 2005, 10:12 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,689 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 16 h 33 m 51 sec
Reputation Power: 53
In HTML, if a checkbox or radio button are not checked/selected, that variable is not passed to the action page. So on the action page you'd want to do:

<cfif structKeyExists( form, 'checkbox' )>
<input name="checkbox" type="hidden" id="checkbox" value="#form.checkbox#">
</cfif>

Reply With Quote
  #5  
Old September 16th, 2005, 01:11 PM
cootjealweer1 cootjealweer1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 28 cootjealweer1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 38 m 59 sec
Reputation Power: 0
I tried to use the code, now i get no error but also no value in the database from checkbox, it doesn't mather if the checkbox is selected or not...

Any ideas?

Reply With Quote
  #6  
Old September 16th, 2005, 01:20 PM
cootjealweer1 cootjealweer1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 28 cootjealweer1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 38 m 59 sec
Reputation Power: 0
Isn't there a way to capture some data from the insert record action?

Reply With Quote
  #7  
Old September 16th, 2005, 01:58 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,689 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 16 h 33 m 51 sec
Reputation Power: 53
I don't understand what you're asking. You seem to be talking about two different things: referencing a form variable on an action page, and getting information about a database insert.

Reply With Quote
  #8  
Old September 16th, 2005, 02:58 PM
cootjealweer1 cootjealweer1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 28 cootjealweer1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 38 m 59 sec
Reputation Power: 0
Ok, i try to explain better,

I have a page that holds an insert record behaviour, when i submit that page the data is written to the database.

Then the page goes to another page where i want to retrieve the value from a form field from the first page (insert record page)

You should say simply do #form.fieldname# but it isn't working.

So the problem is how can i get the form value from the insert record page to the second page, how can i retrieve that value there?

Reply With Quote
  #9  
Old September 16th, 2005, 03:03 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,689 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 16 h 33 m 51 sec
Reputation Power: 53
How is processing being shifted from the database insert page to the form page? It sounds like you are using cflocation, and if that is the case, then you won't be able to access the form variables from the first page any longer, those will die on the database insert page, which is what they are supposed to do. If you want to use cflocation to the form page again, you'll need to manually track the original form variables, either by appending them to the cflocation URL, or by storing them in a persistant scope (session, client, cookie, etc.). Or, assuming you just inserted the form data into the database, just query the data back from the database.

Reply With Quote
  #10  
Old September 16th, 2005, 03:08 PM
cootjealweer1 cootjealweer1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 28 cootjealweer1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 38 m 59 sec
Reputation Power: 0
Ys i'm using cflocation, so that's the problem then...
Ok i'm gonna use your info and try to fix it, thanks

Reply With Quote
  #11  
Old September 16th, 2005, 05:13 PM
cootjealweer1 cootjealweer1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 28 cootjealweer1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 38 m 59 sec
Reputation Power: 0
Ok got it working, i used the query back method you told.

Reply With Quote
  #12  
Old September 16th, 2005, 09:27 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,689 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 16 h 33 m 51 sec
Reputation Power: 53
Yep, form variables only exist for the duration of a single HTTP request. When you initiate a cflocation, you are performing an HTTP redirect which creates a new HTTP request. Once you do that, you form variables are gone. The only way to keep track of them at that point is to persist them somehow, and using the database is exactly what it is for! Glad you got it working.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Retrieve form value from insert (post method - multipart form data) record


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |