This content has been marked as final. Show 7 replies
If your checkboxes are all named the same, then CF will end up with a comma delimited list of values based on what value you assign the checkbox value field.
If you have the required data in the value field of that checkbox, and are writing to a single text file, and you have tested that there are checkboxes checked, simply replace the commas in that list with CHR(10), which is a linefeed character, and write that to the file.
If you need further help, I'll need some more precise details; such as your actual code.
I am guessing one or two things are occurring - you are getting an outright error, or it is not writing the proper data to the file.
To begin with, to detect a checkbox in CF, it should be
If a checkbox is not checked it will not show up for CF at all
Now, having addressed that issue, all your checkboxes are the same name and have no pre-set value, so therefore you are ending up with a variable called "mcall" populated with a comma delimted list of values equal to the number of checked checkboxes.
Unless you specify a value, the default value of a checkbox is "ON" or "YES" depending on browser. If you have 10 rows of output and 3 checkboxes checked, then the variable "mcall" will contain "ON,ON,ON"
Using your 'static' example, I could explain how to either write the content of "mcall" to the txt file with one "ON" per line, or I could show you how to write the static line of "They make this to easy" 3 times; BUT I actually think you have a different idea in mind.
What, exacty, are you trying to write to that TXT file?
The page has four coulmns
name address state location "checkbox"
If i check one.... I want to write that table row to the txt file...I am not getting an error but
the file is not being written too do to the fact my code is not correct....
If you could show me how i can assign those text values from the other <input types> to the checkbox and how to output those
values to a file that would be great!!! or even how i just assign the values to the checkbox
would be great too...thank you!
Here is what i think you meant by assigning the values to my checkbox......Is this the right idea???
<CFINPUT TYPE="checkbox" NAME="mcall" VALUE="what ever you want in here, static or dynamically created by CF">
If this all runs froma database, it could be as simple as a reference ID that can be called again to create the output ... or you could format the exact output for the TXT file from all the data as the value for the checkbox.
Once you get the data Write using the ReplaceNoCase command to change the commas to CHR(10) and it should write each set of data per line.
I have to run to a meeting now, but I'll check back here later - play with it a bit and see what happens.
Thanks for you help first off...................................Here is what i got.....I set my checkbox value to this
<td align="center" class="rightbottom"><input type="checkbox" name="mcall" id="mcall"
Now this is how i am trying to output the values in the table rows that are checked.....Do i use #mcall# for the output varible????? thats what i do here and it goes right to that <cfelse>Your Code is Wrong</cfif> here is what i do
<cfif not IsDefined("form.mcall")>
Take out the "not" ... as your code stands, you are telling it to write to the TXT file if there are no checked boxes ... you need it to write to the file if it DOES find a checked checkbox.
and yes, you would use "form.mcall" as the output variable