• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Multiple Inserts based on check box

Participant ,
Oct 19, 2006 Oct 19, 2006

Copy link to clipboard

Copied

I have a simple form with the attached code in it. The second bit of attached code is my action page. The delete is not happening and the new insert based on the checkbox selection is not happening.

Is using cfif FORM.whichRSM NEQ "" not the correct method?
TOPICS
Advanced techniques

Views

179

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 20, 2006 Oct 20, 2006

Copy link to clipboard

Copied

LATEST
I used this and it worked fine. I was using the database to populate the
options / checkboxes, so you might need to tweek to code if you have static
checkbox names. I also am only inserting information, so you would want to
put a delete SQL statement into the mix before / after:

<cfloop list="#form.fieldnames#" index="field">
<!--- If the field is a list field --->
<cfif (left(field,4) EQ "LIST")>
<CFQUERY Name="ListElement" DataSource="mailer">
INSERT INTO Optouttable (name,email,outoption)
VALUES ('#form.name#','#form.email#', #form[field]#)
</cfquery>
</cfif>
</cfloop>

Then for the form I had:


<form action="" method="post" name="showMeMy">
<cfoutput>
<cfset i = 0>
<cfloop query="optionList">
<table width="100%" border="0">
<cfset i = i+1>
<tr>
<td width="19%"><div align="right">
<input name="list#i#" type="checkbox" id="list#i#"
value="#optionList.listid#">
</div></td>
<td width="81%">#optionList.listName#</td>
</tr>
</table>
<input name="Update" type="submit" id="Update" value="Unsubscribe">
</cfloop>
</cfoutput>
</form>

Not sure if this will work for you, but it might be a step in the right
direction.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation