php - How can I change a form's input value with javascript -
Based on the Witch Combo box item, how can I change the input value of a form with javascript? I have a form with some imported values, and there is an area of imported value that can be changed through comppage in my case:
print ("& lt; input type = 'Hidden' name = 'issue_array [[$ issue [nr]]}] [\ "supplier \"]' value = '{$ issue ["supplier"]} / / "");
I have a combobox, if I change its value then the value of the input above should be changed.
This is what I have done:
print ("Choose name = 'supplier_combo' onchange = 'setSupplierInputValue (this.value, $ {issue [' NR ']}' 'gt; ");
and script:
echo" \ r \ n ".' & Lt; SCRIPT TYPE = "Text / JavaScript" & gt; '.', '\' \ '\' Function SetpluginInputValue (value, issue_nR) '' \ r \ n "; echo" {'"\ r \ n"; echo "issue_array [issue_nr ] ["Supplier"] = value; '; echo'} '"\ r \ n"; echo' '; "\ r \ n";
But this does not work, Please help.
Change your line
issue_array [issue_nr] ["Supplier"] = Value;
To look like this (you have to select the hidden area using the getElementsByName
- or the hidden field Setting ID and getElementById
):
document.getElementsByName ('issue_array [' + issue_nr ''] ["supplier"]) [0] .value = Value;
Comments
Post a Comment