Dynamically Pull In One of Two Fields

I have 2 single line text fields, 1 of which isrequired.

I am hoping to pull one of these two values in to a third hidden field. If the non-required field is blank, use the required field. Otherwise, pull in the non-required field.

Is there anyway to do this?

Check out the filter gform_pre_validation. See specifically example 1. Conditionally Required Field.