Forums

How to pupulate a feild from another field value

novagiant 20 Apr, 2011
USING CF 3.2 / J 1.5
Basically, I want to get values from a field and auto populate another field with it's value. I may have several instances of this on the form to show a grand total at the bottom so the user doesn't have to fill the values twice.

So, here is a very basic example: user has three options... Red, blue and green. (The values of those are Red=$10, Blue=$20, Green=$30) NOTE: I am not trying to calculate anything just show the value from another field.

at the bottom of the form, a text field labeled Grand total automatically gets the value they chose and fills in the text field.

Can anyone point me in the right direction? Thanks.
GreyHead 20 Apr, 2011
Hi novagiant,

JavaScript. Hard to say more without knowing exactly what you need.

Bob
GreyHead 21 Apr, 2011
Hi novagiant ,

For the first field only - similar code will work for the others. Add this into the Form JavaScript:
window.addEvent('domready', function() {
  $('textfield1').addEvent('change', function() {
    $('textfield4').value = $('textfield1').value;
  });
});
Not tested and may need debugging.

Bob
This topic is locked and no more replies can be posted.