how can I autofill a field depending on a previous field?
Posted: Mon Jan 17, 2011 12:50 pm
hi, I have created two fields that only accept numerical values. What I would like is if the second field is left blank to be auto filled with the first field but with an extra amount added on.
this is my current code, what I want is some code that says, auto fill field two with the amount entered into field one but with 10.00 added on.
how can I do this?
Thanks for any help
Code: Select all
$form['base']['number']['one'] = array(
'#type' => 'textfield',
'#title' => t('one'),
'#required' => TRUE,
'#weight' => 1,
'#size' => 20,
'#maxlength' => 35,
);
$form['base']['number']['two'] = array(
'#type' => 'textfield',
'#title' => t('two'),
'#required' => FALSE,
'#weight' => 2,
'#size' => 20,
'#maxlength' => 35,
);
how can I do this?
Thanks for any help