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:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old April 15th, 2004, 02:42 PM
mateoc15's Avatar
mateoc15 mateoc15 is offline
C A R D S
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2004
Location: The 'Ville
Posts: 763 mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 7 h 42 m 24 sec
Reputation Power: 13
problem passing values through 2 forms

my first form gets a category... the second form displays the ability to enter values in a table where the category is the category previously entered... the input is disabled, but displayed... like so...

<INPUT type="text" name="category2" value="#form.category#" disabled>

i used input, not cfinput, because disabled is not supported by cfinput...

so i get to the third step (actually inserting the values into the table), and it says no value associated with form.category2... shouldn't the value be the same value that was inserted into form.category?

i'm missing something here...
__________________
Reinventing the wheel again

Reply With Quote
  #2  
Old April 15th, 2004, 02:53 PM
chrisgreen chrisgreen is offline
Webmaster
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 23 chrisgreen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hello,

firstly disabled *is* supported by cfinput but you have to use the passthrough attribute, remember if using cfinput, you need to use cfform.

Secondly from what I interpret your problem to be, (forgive me if i am wrong) is that the form value "form.catergory2" is no longer availible as form variables are not persistant. You need to save the first form variable as a variable with a persistant scope such as request or client, then insert the value "client.catergory2".

Tell me if i've got the wrong end of the stick completely and i'll rethink my answer.

Reply With Quote
  #3  
Old April 15th, 2004, 04:47 PM
mateoc15's Avatar
mateoc15 mateoc15 is offline
C A R D S
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2004
Location: The 'Ville
Posts: 763 mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 7 h 42 m 24 sec
Reputation Power: 13
Ok, used the passThrough now...

But if I say something like...

FIRST FORM---
<cfinput type="text" name="category">

SECOND FORM---
<cfinput type="text" name="category2" value="#form.category#" passThrough="disabled">

then why wouldn't category2 hold the value input into category in the first form? meaning when i try to grab category2 in the third form, why doesn't it equal category?

Thanks....

Last edited by mateoc15 : April 15th, 2004 at 05:24 PM.

Reply With Quote
  #4  
Old April 15th, 2004, 07:01 PM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,488 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 3 Days 18 h 10 m 11 sec
Reputation Power: 42
Keep in mind that not all browsers support "disabled", so your carefully crafted solution could very possibly be sidestepped anyway. I'd avoid it altogether and just use a hidden form field and/or display the data as HTML text instead of trying to use a disabled form field.

Reply With Quote
  #5  
Old April 15th, 2004, 08:28 PM
mateoc15's Avatar
mateoc15 mateoc15 is offline
C A R D S
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2004
Location: The 'Ville
Posts: 763 mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 7 h 42 m 24 sec
Reputation Power: 13
I must really not be understanding...

I have looked up client and request variables in the documentation. How is there a difference in the way that they are assigned? Are they stored in a different location? If I set SOMEVARIABLE = #form.category#, where in the logic should I do it? What about CFAPPLICATION? Can I just use CFSET to set an application variable? TRULY LOST NOW...

Thanks

Reply With Quote
  #6  
Old April 15th, 2004, 11:01 PM
mtangorre mtangorre is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: Silver Spring, MD
Posts: 12 mtangorre User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to mtangorre Send a message via MSN to mtangorre
Quote:
Originally Posted by chrisgreen
Secondly from what I interpret your problem to be, (forgive me if i am wrong) is that the form value "form.catergory2" is no longer availible as form variables are not persistant. You need to save the first form variable as a variable with a persistant scope such as request or client, then insert the value "client.catergory2".

Tell me if i've got the wrong end of the stick completely and i'll rethink my answer.


The request scope is not persistant in this sense. This is a simple problem and the simple solution is as follows:

If one form posts to another form simply refernce the variable on the second form as form.varName or form['varName'], whichever syntax you prefer. If form 1 does not post to form 2, then you need to keep track of the initial form value via a perst.. scope (session, cookie, client). Don't forget to clear it out when you are done using it and always cfparam your values so they always exist when you need them to, then just check for content.

HTH,

Mike

Last edited by mtangorre : April 15th, 2004 at 11:07 PM.

Reply With Quote
  #7  
Old April 16th, 2004, 08:44 AM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,488 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 3 Days 18 h 10 m 11 sec
Reputation Power: 42
Quote:
Originally Posted by mateoc15
I must really not be understanding...

I have looked up client and request variables in the documentation. How is there a difference in the way that they are assigned? Are they stored in a different location? If I set SOMEVARIABLE = #form.category#, where in the logic should I do it? What about CFAPPLICATION? Can I just use CFSET to set an application variable? TRULY LOST NOW...
Maybe at this point it would help if you explained what you are trying to do in more detail. Do you simply have 2 form pages, and you want the data from the first form page to be embedded in the form on the second page, so that when the user submits the second form it sends the data for both the first and second forms to the target page? If this is what you want, you're making this way more complicated than it needs to be.

Reply With Quote
  #8  
Old April 16th, 2004, 10:07 AM
mateoc15's Avatar
mateoc15 mateoc15 is offline
C A R D S
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2004
Location: The 'Ville
Posts: 763 mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 7 h 42 m 24 sec
Reputation Power: 13
Quote:
Originally Posted by kiteless
Maybe at this point it would help if you explained what you are trying to do in more detail. Do you simply have 2 form pages, and you want the data from the first form page to be embedded in the form on the second page, so that when the user submits the second form it sends the data for both the first and second forms to the target page? If this is what you want, you're making this way more complicated than it needs to be.


If I'm reading you correctly, that's just what I need. Check out the link I supplied earlier...

http://cislab2.cbpa.louisville.edu/...chandiseAdd.cfm

The first one gets a category (generated from a query), then the fields for that category are input (see second page... try it out). Then the error occurs when the data from the second form (merchandiseAdd2.cfm) is inserted into the table as a new record. Error says that #form.category# does not exist basically.

So there's an easier way to do this? What did you mean exactly by that, KITELESS?

I have an idea... why don't I just paste the code from EACH of the three...

merchandiseAdd.cfm
Code:
<CFINCLUDE template="includes/header.cfm">
<CFQUERY datasource="#DataSource#" name="categoryQuery">
	SELECT DISTINCT Category
	FROM Category
</CFQUERY>
<HTML>
<HEAD><LINK rel="stylesheet" href="includes/style.css"></HEAD>
<BODY>
<CFFORM action="merchandiseAdd2.cfm" method="post">
	<CENTER>
	<SPAN class="title">Select a category to which you wish to add:</SPAN>
	<BR>
	<CFSELECT name="category">
		<OPTION value="" selected>----------
		<CFOUTPUT query="categoryQuery">
		<OPTION value="#Category#">#Category#
		</CFOUTPUT>
	</CFSELECT>
	<BR>
	<INPUT type="submit" value="Add record to this Category">
	</CENTER>		
</CFFORM>
</BODY>
</HTML>


merchandiseAdd2.cfm
Code:
<CFINCLUDE template="includes/header.cfm">
<HTML>
<HEAD><LINK rel="stylesheet" href="includes/style.css"></HEAD>
<BODY>
<CFFORM action="merchandiseAdd3.cfm" method="post">	
	<CENTER>
	<SPAN class="title">Enter your new record:</SPAN><BR>
	<CFOUTPUT>
	Item ID:<CFINPUT type="text" name="itemid" required="yes">&nbsp;&nbsp;
	Description:<CFINPUT type="text" name="description" required="yes">&nbsp;&nbsp;
	Quantity On Hand:<CFINPUT type="text" name="qoh" required="yes">&nbsp;&nbsp;
	<BR>
	List Price: $<CFINPUT type="text" name="listprice" required="yes">&nbsp;&nbsp;
	Category:<CFINPUT type="text" name="category" value="#form.category#" passThrough="disabled">
	<BR>
	<INPUT type="submit" value="Submit New Record to #form.category#">
	</CFOUTPUT>
	</CENTER>
</CFFORM>
</BODY>
</HTML>


merchandiseAdd3.cfm
Code:
<CFINCLUDE template="includes/header.cfm">
<CFQUERY datasource="#DataSource#" name="existingItemID">
	IF #form.itemid# NOT IN(SELECT ItemID FROM Merchandise)
		INSERT INTO Merchandise (ItemID, Description, QuantityOnHand, ListPrice, Category) VALUES (#form.itemid#, '#form.description#', #form.qoh#, #form.listprice#, '#form.category#')
</CFQUERY>
<HTML>
<HEAD><LINK rel="stylesheet" href="includes/style.css"></HEAD>
<BODY>
<CFIF existingItemID.getRowCount() IS 0>
	<CFOUTPUT>Record could not be added. Item ID #form.itemid# already exists in the table.</CFOUTPUT>
<CFELSE>
<CENTER>
	<SPAN class="title">Your new record successfully inserted:</SPAN><BR>
	<TABLE width="700">
	<TR>
		<TH>Item ID</TH>
		<TH>Description</TH>
		<TH>Quantity On Hand</TH>
		<TH>List Price</TH>
		<TH>Category</TH>
	</TR>
	<CFOUTPUT query="merchandiseQuery">
	<TR>
		<TD>#ItemID#</TD>
		<TD>#Description#</TD>
		<TD>#QuantityOnHand#</TD>
		<TD>#LSNumberFormat(ListPrice, "$___,___.__")#</TD>
		<TD>#Category#</TD>
	</TR>
	</CFOUTPUT>
</CENTER>
</CFIF>
</BODY>
</HTML>

Reply With Quote
  #9  
Old April 16th, 2004, 10:39 AM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,488 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 3 Days 18 h 10 m 11 sec
Reputation Power: 42
First, lets back off a second. When it comes to troubleshooting and problem solving, the best thing you can do is strip everything away except for the things that exhibit the problem or error. So lets create 3 very simple pages that should illustrate a solution. From there, you can take what you need to scale it up to your situation.

Code:
Page 1<p>
<form action="page2.cfm" method="post">
Form 1 Text: <input type="text" name="form1text">
<input type="submit" value="Go To Page 2">
</form>


Code:
Page 2<p>
<cfoutput>
<form action="page3.cfm" method="post">
Data from form 1: #form.form1text#<br>
<input type="hidden" name="form1text" value="#form.form1text#">
Form 2 Text: <input type="text" name="form2text">
<input type="submit" value="Go To Page 3">
</form>
</cfoutput>


Code:
Page 3<p>
<cfdump var="#form#">


This posts the first form to page 2, where that data is placed into a hidden form field. When the form on page 2 posts, it posts the new form 2 data along with the data from form 1 that is now in the hidden form field. As you can see, on page 3 the dump of the form scope shows the data from both forms.

Reply With Quote
  #10  
Old April 16th, 2004, 11:22 AM
mateoc15's Avatar
mateoc15 mateoc15 is offline
C A R D S
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2004
Location: The 'Ville
Posts: 763 mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level)mateoc15 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 7 h 42 m 24 sec
Reputation Power: 13
FINALLY, SUCCESS!

I used a hidden field, but I still don't understand why it must be a hidden field rather than using the VALUE from the DISABLED field. If a field is disabled, you apparently cannot get a value from it using form.disabledfieldname

Reply With Quote
  #11  
Old April 16th, 2004, 11:38 AM
kiteless kiteless is offline
Moderator
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,488 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 3 Days 18 h 10 m 11 sec
Reputation Power: 42
Like I said, I never use disabled fields because they are not uniformly supported, so I have no idea how their data is handled. Stick with what's standard.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > problem passing values through 2 forms


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

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.