Onchange of the dropdown list, the textfield should display either "testing 3" or "testing 4" but nothing is happening.

<form action='submit.php' method='POST' name='form'>
    <select name='preset' onchange='preset(this);'>
       <option value='test1'>testing 1</option>
       <option value=test2'>testing 2</option>
   </select>

<input type='text' name='big[]' value='' />

</form>
function preset(ele) {

if(ele=="test1") {
  var action1 = "testing 3";
} else {
  var action1 = "testing 4";
}

  document.form."big[0]".value = action1;

}

ele will, as the name correctly suggests, be an element, not a string. To get it's value attribute, use ele.value .

replace ur line 2 with

<select name='preset' onchange='preset(this.value);'>

and

line 9 with

document.form.big[0].value = action1;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.