I have a web form with multiple elements with the same name for example:
<textarea name="instructions"><cfoutput>#struct.instructions# </cfoutput> </textarea>
Form is built in html/coldfusion/js and the database to store the data is MS Access.
In the script that I am using to process form submission I am using ListToArray method to get all fields with a given name.
<cfset arrayInstr = ListToArray(Form.instructions)>
Ok and here is the problem. If the submitted text contains comas ListToArray will interpret it as multiple elements.
For example if I try to submit a string “Bla bla bla bla” everything will be fine, but if string will be “bla, bla, bla” only “bla” will be submitted to database.
Is there other way to process multiple fields with the same name?
I would like to avoid giving unique names.
thank you,
Janusz
Q: Is there other way to process multiple fields with the same name?
A: Not directly
Javascript sees the items as a array. What you would need to do is have Javascript loop through all the values and create a string with a different delimiter and put that into a hidden field. The distinction between different
<textarea>‘s and commas would be maintained.