Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / April 2007



Tip: Looking for answers? Try searching our database.

Overriding form variables

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
noobie2005 - 26 Apr 2007 21:47 GMT
Hi,

Is there any way to override a form variable that is being passed. Would it be
done via cfif?
....
Ok, that's a bit vague, so I'll try to clarify (I'm a little tired so bear
with me :confused;). I have the user fill out a form adding a new part to their
inventory. If there going to take some parts out of the new stock there putting
in to the database, it would leave a net amount (Gross amount being what was
originally going to be inserted). So, on the update page, would I put that cfif
statement in saying

<cfif #FORM.resNet# NEQ "">
    <cfset #FORM.sOnHand# EQ #FORM.resNet#>
</cfif>

resNet being the resultant total of the previous calculation and sOnHand being
the previous amount (gross) that would have been inserted in the form if the
resNet field would have been left blank.

I [b]hope[/b] my point got across.

Thank you in advance!
Dan Bracuk - 27 Apr 2007 04:49 GMT
What happened when you tried the code you are asking about?  By the way, in that specific piece of code, you don't need octothorps.
noobie2005 - 27 Apr 2007 13:38 GMT
Element RESNET is undefined in FORM.

Why don't I need octothorps?
Dan Bracuk - 27 Apr 2007 14:58 GMT
Are all your datatypes char or varchar?
noobie2005 - 27 Apr 2007 15:14 GMT
It's an access database, so...the sOnHand field is set to Number, if that's what you're asking
Dan Bracuk - 27 Apr 2007 16:48 GMT
Then get rid of the quotes around that value.
insuractive - 30 Apr 2007 19:53 GMT
a couple of (hopefully helpful) notes about your syntax:

<cfif #FORM.resNet# NEQ "">
<cfset #FORM.sOnHand# EQ #FORM.resNet#>
</cfif>

1) Dan's octothorp comment: If you are using a CF variable inside a <cfif> or
<cfset> tag, you don't need to use the # symbol.  CF will evaluate those values.
2) The second line should be: <cfset FORM.sOnHand = FORM.resNet> (notice the =
sign)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.