I have to populate form fields with values that are dependent on a lookup "link" value. My plan is to use Ajax to accomplish this. I would appreciate some help incorporating the html and javascript into my Jobs_add.php and Jobs_add.htm files or any other files that need modification.
- I plan to use the hidden frame method and figure I can put the following into the HEAD section of Jobs_add.htm:
<frameset rows="100%,0" frameborder="0">
<frame name=" displayFrame" src=" display.htm" noresize=" noresize" />
<frame name=" hiddenFrame" src=" about:blank" noresize=" noresize" />
</frameset>
- My js function can be placed in the HEAD section of Jobs_add.htm as well? Will document.getElementById("CustomerID").value return the CustomerID "link value" or "display value" from the lookup dropdown?
function requestCustomerAddress() {
var sId = document.getElementById("CustomerID").value;
top.frames["hiddenFrame"].location = "getcustomeraddress.php?id=" + sId;
}
- Where do I put - onchange=" requestCustomerAddress()" -
I figure if I can understand this half of the process reading the info back into the form will be evident. Below is some of the code from Jobs_add .htm and .php. Thanks for any help I can get on this.
<TD style="BACKGROUND-COLOR: #e8fecf" width=279 colSpan=3>
{build_edit_control field="customerID" value=$value_customerID mode="add"} </TD>
// processing customerID - start
$value = postvalue("value_customerID");
$type=postvalue("type_customerID");
$value=prepare_for_db("customerID",$value,$type);
if(!($value===false))
$avalues["customerID"]=$value;
// processibng customerID - end