www.webdeveloper.com
Results 1 to 3 of 3

Thread: Seperate concatenated form values

  1. #1
    Join Date
    May 2004
    Location
    NS, Canada
    Posts
    108

    Question 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.

    Code:
    <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??

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

  2. #2
    Join Date
    Mar 2007
    Posts
    946
    I would suggest doing this with server side code.

  3. #3
    Join Date
    May 2004
    Location
    NS, Canada
    Posts
    108
    Thanks for the reply skywalker2208, and after I finally got a javascript example mostly working on my own, I did end up finding an easier way to do it with cold fusion using the ListToArray() function!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles