fill subsequent form fields based on input to a field

fill subsequent form fields based on input to a field

I'm sure this has been answered, but I could find the answer, so i'm asking.

I'd like to have several field of one of my forms, populate with existing data if a previous field indicates the person has given us their information previously.

Specifically, when they fill in their name, if they have previously given us their email, the email field would be automatically filled in with the email they have given us. They could then either skip the email field (because it is already correct) or they could enter an new email address.

Conceptually it seems simple to me, but I can't figure out how to write it in deluge. Can any one give me a clue or a snippet of code that works for you?

Thanks
Dave Lee