How to replace value of text box? I have 2 input fields in my drupal form. When end user inserts some value in first input, I want to auto insert the second input field. How can I achieve this.

Here is my code.

input form element 1

// total fee of the payment schedule
    $form['fee'] = array(
        '#type' =&gt; 'textfield',
        '#title' =&gt; 'Fee Amount:',
        '#default_value' =&gt; (isset($fee_details-&gt;fee)) ? $fee_details-&gt;fee : '',
        '#maxlength' =&gt; 5,
        '#required' =&gt; TRUE,
        '#description' =&gt; t('Fee amount'),
        '#id' =&gt; "fee",
        '#element_validate' =&gt; array('element_validate_integer'),       
'#ajax' =&gt; array(
            'callback' =&gt; 'replace_fee_instalment', 
  'wrapper' =&gt; 'replace_textfield_div',
),
    );


Input field 2nd is 

 $form['amount'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; t('Instalment'),
    '#title_display' =&gt; 'invisible',
    '#default_value' =&gt; ($amount) ? $amount : '',
        '#maxlength' =&gt; 5,
        '#element_validate' =&gt; array('element_validate_integer'),
  );
I think u need to use javascript for this. 
on the keypress event handler for the first textbox, u can get the text of the first textbox and update the second textbox using javascript itself