Auto fill a textbox after selection

Discussion in 'Programming' started by SamM-T, May 14, 2008.

  1. #1
    I'm developing a flash for in CF that records a quantity number against a stock item in a warehouse.

    The stock item has two parts a Name 'Phone' and a Code 'xfs34'. I have a selection list auto populate the Name from a table and would like to have a textbox auto fill with the corresponding code and update onChange.

    Is there a simple way to do this?

    My Query:
    <cfquery name="stkchk" datasource="SD">
    SELECT NameID, StockName, TitanCode
    FROM StockNameTable
    </cfquery>
    Code (markup):
    Select list and textbox:
    <cfselect name="StockName" size="1" id="StockName" title="StockName" label="Item" width="150" type="select" onChange="">
    <cfoutput query="stkchk">
    <option value="#stkchk.StockName#">#stkchk.StockName#</option>
    </cfoutput> </cfselect>
    <cfinput id="TitanCode" title="TitanCode" name="TitanCode" width="150" type="text" label="Titan Code" readonly="yes" value="#stkchk.TitanCode#" />
    Code (markup):
    Thanks in advance any help is greatly appreciated..
     
    SamM-T, May 14, 2008 IP
  2. apmsolutions

    apmsolutions Peon

    Messages:
    66
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you are using Coldfusion 8, you can use cfajax.

    http://www.indiankey.com/cfajax/

    If you are using other versions, you can always use a prototype to call ajax...probably your best method anyway.
     
    apmsolutions, May 15, 2008 IP
  3. SamM-T

    SamM-T Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for that, I'll check it out.
     
    SamM-T, May 15, 2008 IP