[thelist] CF: No IsDefined()?

.jeff jeff at members.evolt.org
Thu Sep 13 16:47:50 CDT 2001


matt,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Warden, Matt
>
> I'm no CF guy here, but I believe you meant that *****
> is the "name" of the submit image, not the value.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

that's correct.  it's the name that's sent.  image submits do not have
values.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> For those who might not know, when an submit image with
> name "foo" is clicked, two variables are sent with teh
> POST data:
>
> foo.x = something
> foo.y = something
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

or, the following if the image submit is not named:

x = something
y = something

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> I can't say I know what happens when the keyboard only
> is used to submit a form by way of the submit image
> (anyone know?).
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

for those browsers that can submit forms with the enter button, they send
the coordinates 0, 0.

fwiw, there are techniques for combining multiple image submits into a
single form with the same name and determining which one is clicked.  the
trickery involves combining them into the same image (if possible) and if
the x coordinate is less than a certain number it's the one on the left or
more than a certain number the one on the right.  or if they're stacked it'd
be the y coordinate.  if it's not possible to combine them then you'd have
to create unique names for each one and test for the name that's sent.

<tip author=".jeff" type="ColdFusion">

using multiple submit buttons and they have unique names?

in the template on the receiving end of the post, param each one.

<cfparam name="form.submit1" default="">
<cfparam name="form.submit2" default="">
<cfparam name="form.submit3" default="">

then check the length to determine which one was clicked.

<cfif Len(form.submit1)>
  do stuff for 1st button
<cfelseif Len(form.submit2)>
  do stuff for 2nd button
<cfelseif Len(form.submit3)>
  do stuff for 3rd button
</cfif>

using image submits instead?  param them first:

<cfparam name="form.submit1.x" default="0">
<cfparam name="form.submit2.x" default="0">
<cfparam name="form.submit3.x" default="0">

then check them for a value greater than 0.

<cfif Val(form.submit1.x)>
  do stuff for 1st button
<cfelseif Val(form.submit2.x)>
  do stuff for 2nd button
<cfelseif Val(form.submit3.x)>
  do stuff for 3rd button
</cfif>

</tip>

good luck,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/






More information about the thelist mailing list