Gilbert,
I think I see what you're saying. Is this what you're after? (of
course you'd build the form dynamically)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>
<cfif isdefined('form.submit')>
  <cftransaction>
  <cfloop list="#FORM.fieldnames#" index="i">
  <cfif i CONTAINS "newsletter">
   <cfquery name="deliveryMethod" datasource="">
   INSERT INTO deliveryMethod (customerID,
customerRequestItem, deliveryMethod)
   VALUES ('#FORM.customerID#', '#Mid(i,14,11)#',
#Right(i,1)#)
   </cfquery>
    </cfif>
  </cfloop>
  </cftransaction>
</cfif>
<body>
<form action="" method="post" name="form1" id="form1">
Newsletter 1
<input type="radio" name="newsletter1" value="1">
<input type="radio" name="newsletter1" value="2">
<input type="radio" name="newsletter1" value="3">
<br>
Newsletter 2
<input type="radio" name="newsletter2" value="1">
<input type="radio" name="newsletter2" value="2">
<input type="radio" name="newsletter2" value="3">
<br>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
-----Original Message-----
From: Gilbert Midonnet [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 31, 2004 5:47 PM
To: CF-Talk
Subject: Re: loops and radio buttons

Thanks Greg,

It helped a lot but I still have some questions.

It looks as if you can't pull a value in this method. Everything must
come from the name field. So for example

the root name (so to speak) is deliveryMethod and the publicationID and
delivery method need to be combined with the name.

<input type="radio" name="deliveryMethod#publicationID#online">

To make pulling data easier I would use 1,2,3 for the delivery method 1=
online 2= mail 3= both

EXAMPLE BELOW:

<cftransaction>
<cfloop list="#FORM.fieldnames#" index="i">
<cfif i CONTAINS "info_purchase">

<cfquery name="deliveryMethod" datasource="">

INSERT INTO deliveryMethod
(
customerID,
customerRequestItem,
deliveryMethod
)
VALUES
(
'#FORM.customerID#',
'#Mid(i,14,11)#',
#Right(i,1)#
)

</cfquery>
  </cfif>
</cfloop>
</cftransaction>

It works, thanks very much. Just wondering if I'm missing anything here.

==================

>Gilbert,
> This should loop over all the radio buttons that were in the
submitted
>form who's name starts with 'deliverymethod'.
>
>Greg
><cftransaction>
> <cfif isDefined("form.submit")>
> <cfloop list="#FORM.fieldnames#" index="i">
>       <cfif i CONTAINS "deliverymethod">
>   <cfquery>
>   stuff
>   </cfquery>
>       </cfif>
> </cfloop>
> </cfif>
></cftransaction>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to