hello,
I use a form with a naming structure of formName#ID#. The CF
template ends up making multiple forms which is why i thought the #id#
part would be a good idea, to allow for identifying which form i want
to work on. The problem is that when i try to refer to the form name
in any CF template
On Tuesday 11 Mar 2008, Phillip Perry wrote:
SomeVariable=formName#ID# I get an error referring to the #'s.
You should always scope variables, i.e.
SomeVariable=form[formName#ID#]
--
Tom Chiverton
Helping to elementarily brand corporate paradigms
on: http://thefalken.livejournal.com
Assuming that 'formName' is literal text...
cfset SomeVariable=formName#ID# ??
Or
cfset SomeVariable=formName ID ??
-Original Message-
From: Phillip Perry [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 11, 2008 7:59 AM
To: CF-Talk
Subject: Naming Forms randomly
hello,
I use
You can also use evaluate(formnameid) to get at the different form elements
cfset name = evaluate(formnameid).name
Rob
hello,
I use a form with a naming structure of formName#ID#. The CF template ends
up making multiple forms which is why i thought the #id# part would be a
good idea, to allow
I think this problem stems from CF syntax being too loose with regards its #
symbols which leads to misunderstanding and confusion.
If you want to set someVariable to the value pointed to by the variable
someForm234 you could do:
cfset someVariable = Evaluate(someform#ID#) or cfset someVariable =
I've tried the Evaluate() example you provided but now I'm getting an
error that my variable is undefined.
This is the code I've been using for testing...
cfparam name=thisOtherThing type=numeric default=1
cfset thisOtherThing=Evaluate(qty_adjust#theid#.current_qty.value)
form
Phillip,
Your bracket is in the wrong spot
cfset this otherthing = evaluate(qty_adjusttheid).current_qty
That should work.
Rob
I've tried the Evaluate() example you provided but now I'm getting an
error that my variable is undefined.
This is the code I've been using for testing...
cfparam
The problem is that when i try to refer to the form name
in any CF template
I may be wrong, but AFAIK, the form name is not transmitted by HTTP, it
is only available to
Javascript on client side.
Even if a page contains several forms, only one can be submitted at a time,
and all its fields are
I may be wrong, but AFAIK, the form name is not transmitted by HTTP, it
is only available to
Javascript on client side.
Even if a page contains several forms, only one can be submitted at a
time,
and all its fields are referred in the form scope in the action template.
So there is no use
Thanks, but now it says that qty_adjust1, which is what its supposed
to be, is undefined. qty_adjust1 is the name of the first form.
On Tue, Mar 11, 2008 at 2:30 PM, Rob Parkhill [EMAIL PROTECTED] wrote:
Phillip,
Your bracket is in the wrong spot
cfset this otherthing =
Thank you. This is the answer I was looking for. I knew there was
another way to refer to the separate forms but I haven't been coding
for quite a while so my mind got caught wrapped around the naming form
idea. Thanks again.
On Tue, Mar 11, 2008 at 1:39 PM, Claude Schneegans
[EMAIL PROTECTED]
Something just occured to me. If i make a hidden field and put the ID
value in there, Wouldn't the name of the field be the same for every
form? so naming the hidden field somevar wouldn't work. cfset
myvar=form.somevar would have a value of whatever the last form has
correct?
On Tue, Mar 11,
I have seen some people just do it off the value of the Submit button.
Although kind of sucks when they change the value in the button but forget
to change their switch/case or if/else on the processing end of things.
On Tue, Mar 11, 2008 at 12:47 PM, Dominic Watson
[EMAIL PROTECTED] wrote:
If i make a hidden field and put the ID
value in there, Wouldn't the name of the field be the same for every
form?
Not if you're wise enough to use a separate hidden field with a
different id for each form ;-)
Keep in mind that only ONE form gets to the action page.
--
I have seen some people just do it off the value of the Submit button.
Although kind of sucks when they change the value in the button but forget
to change their switch/case or if/else on the processing end of things.
You can do that, but if your user hits return to submit the form, the
Keep in mind that only ONE form gets to the action page.
This helps, kinda. The way i have the form now 1 form is made for each
item in the session. I guess I need to remake my form so that only one
gets made and separate buttons/submit buttons get sent to the action
page.
I'm not sure what your end goal is but I think there are are two things you
could be wanting to do:
1. All forms are identical but for the id of the item they are acting on.
Processing the forms will be the same for each:
cfloop query=ids!--- assuming you have a query of IDs ---
form
Yes, the same people I have seen do it also only allow the form to be
submitted via JS. I have even seen where they only allow it to be submitted
from JS then they populate a hidden form value with a label, which again
seems flawed because then in the processing code they check for specific
Well, I figured it out. Thank you for all the replys. What i needed to
do is add a hidden field to the form and then just manipulate the
information passed through that. I'm making a shopping cart. I was
trying to dynamically update the qty value if a user clicked +/-. I
was having a hard time
In this code:
cfset session.cart[#prodID#].quantity=session.cart[#form.prodID#].quantity+1
the # symbols are completely unnecessary.
cfset session.cart[prodID].quantity=session.cart[form.prodID].quantity+1
will work just the same.
On Wed, Mar 12, 2008 at 9:33 AM, Phillip Perry [EMAIL
20 matches
Mail list logo