Thursday, 15 March 2012

javascript - Selecting a value in an input field and then populate another field with corresponding data -


I have a form that has an input field with data field, which is receiving data from PHP here That code skip.

  & lt; Input type = text list = jobs style = 'font-size: 21px; Height: 40px; ' Class = 'form-control' name = "code" & gt; & Lt; Datalist id = jobs & gt; & Lt ;? Php foreach ($ this-> product as $ one) {echo '& lt; Option value = '. $ A ["code"] '' Gt; ' . $ A ["code"] "-" $ A ["name"] '& lt; / Option & gt; '; ?} & Gt; & Lt; / DataList & gt;  

When you select the record that was created in the field only shows the $ code, then what I want below is a reading only input field that shows $ name for the selected item.

How can this get javascript / jquery

I think What you want is a label:

  echo & lt; Label & gt; '+ $ A ["name"] +': '; Echo '& lt; Option value = '$ A ["code"]' & gt; ' . $ A ["code"] "-" $ A ["name"] '& lt; / Option & gt; '; Echo '& lt; / Label & gt; ';  

No comments:

Post a Comment