Quantcast
Channel: Adobe Community : Unanswered Discussions - ColdFusion
Viewing all articles
Browse latest Browse all 5794

How to handle commas within a List on web form?

$
0
0

I have a web form, something like:

 

<form>

<input type="text" name="objectives" value="This is a test">

<input type="text" name="objectives" value="And another, if you know what I mean.">

<input type="text" name="objectives" value="And yet another.">

<input type="submit" name="btnGo" value="Do It">

</form>

 

And an action page that submits it to a db. The trouble is, the objectives will have commas in them, occasionally, and CF turns each comma into a list item, so my loop looks like:

  1. This is a test
  2. And another
  3. if you know what I mean
  4. And yet another

 

but I want:

  1. This is a test
  2. And another, if you know what I mean
  3. And yet another

 

What I want to do is loop through the objectives, retaining the commas within the elements. I've been struggling with this for days. I want to avoid having to write some replace method in JS if I can help it.

 

Thanks!

 

How I'm looping:

<cfset values = ListToArray(#FORM['objectives']#)>

<cfloop index="i" list="#FORM['objectives']#">

      x=#i#<br />

</cfloop>


Viewing all articles
Browse latest Browse all 5794

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>