I have the following custom HTML:
<span name="Customer_Name"></span><br>
<span name="Address"></span><br>
<span name="Address2"></span><br>
<span name="City"></span>, <span name="State"></span>
<span name="Postal_Code"></span>
The values are passed to the HTML span names when the source field triggers the following function:
function mapData(e){
var value = '';
// radio fields
if(e.hasClass('dataRadio')){
value = e.find('.cf-field input:checked').val();
}
// input fields
else {
value = e.find('.cf-field :input').val() || $(e).find('.cf-field div[type]:eq(0)').html() || '';
}
// get the variable name of the trigger field
var name = e.attr('attr');
// update display field value
$('span[name="' + name + '"]').html(value.replace(/\n/g,'<br>'));
}
Since Address2 is often empty I end up getting a "gap" in the customer address:
So I am looking for a way to tweak this process to essentially ignore Address2 when it's empty. Thanks in advance for any suggestions.