Seperate concatenated form values

I have 4 text boxes that are supposed to load 4 seperate values of data from one field in one table from a database. The field is called interface_cropsettings (from the interface table) and these values have been concatenated and comma seperated in this field.



<TR>
	<TD WIDTH="350" CLASS="tabledata"><INPUT TYPE="TEXT" SIZE="55" NAME="txtInterfaceXPosition" maxlength="10" <CFIF IsDefined("isEdit")>VALUE="#qryEditInterface.interface_cropsettings#"></CFIF></TD>
</TR>
<TR>
	<TD WIDTH="350" CLASS="tabledata"><INPUT TYPE="TEXT" SIZE="55" NAME="txtInterfaceYPosition" maxlength="10" <CFIF IsDefined("isEdit")>VALUE="#qryEditInterface.interface_cropsettings#"></CFIF></TD>
</TR>
<TR>
	<TD WIDTH="350" CLASS="tabledata"><INPUT TYPE="TEXT" SIZE="55" NAME="txtInterfaceCropHeight" maxlength="10" <CFIF IsDefined("isEdit")>VALUE="#qryEditInterface.interface_cropsettings#"></CFIF></TD>
</TR>
<TR>
	<TD WIDTH="350" CLASS="tabledata"><INPUT TYPE="TEXT" SIZE="55" NAME="txtInterfaceCropWidth" maxlength="10" <CFIF IsDefined("isEdit")>VALUE="#qryEditInterface.interface_cropsettings#"></CFIF></TD>
</TR>


Once the form is filled out and saved, the data is inserted into the database and the values from these 4 text boxes are concatenated, comma seperated and inserted into that one field correctly.

(Example)

If the 4 text boxes have the following values:

X Position = 12.34
Y Position = 56.78
Crop Height = 250
Crop Width = 500

in the database field they become:

12.34,56.78,250,500

However, if the form is closed and then re-opened, each text box displays the entire database field rather then each value seperated in the corresponding text box.

(Example)

All 4 text boxes display this:

12.34,56.78,250,500

I already know why the data appears like this in the form, my problem is that I’m not sure how to write the javascript to seperate the values into the correct corresponding fields, assuming javascript is what I should be using! Can anyone help me out with this?? :smiley:

Also, this is kind of irrelevant but just in case you’re wondering, this form is part of a cold fusion application!

Your cold fusion code should be doing this job, not javascript. On another related note, you generally shouldn’t be putting these 4 different values into a single database column by using string concatenation. They are 4 distinct pieces of data. Give them their own columns.

I understand that it’s not a good idea to put multiple pieces of data into one database column using string concatenation, however is this case it is required, I won’t get into why but trust me it is!! If the answer is actually within cold fusion, can anyone else suggest a course of action without pointing out why it shouldn’t be done this way?? lol … I had a feeling I should have created this thread under the cold fusion section, just please don’t point that out also haha and if it needs to be under that section to get an answer, how do I get it moved there?

Nevermind, after I finally got a javascript example mostly working, I found an easier way to do it with cold fusion using the ListToArray() function! Thanks though!!