Copying text from one field to another on a Job Form - MKB 0065 Follow
Are you copying text out of an ezMerge template?
YES
1. Create an HTML field on your order form. Name it anything you'd like.
2. Copy/Paste the following code into the new HTML field. Be sure to replace udf_NameOfAEMFieldOnForm, NameOfAEMField, and udf_FieldToBeAutoFilled below.
<script type="text/javascript">
<!--
$(document).ready(function(){
function CopyText() {
$('#udf_FieldToBeAutoFilled').val($('#udf_NameOfAEMFieldOnForm\\:NameOfAEMField').val());
}
$('#udf_NameOfAEMFieldOnForm\\:NameOfAEMField').bind('change', function(e) { CopyText(); });
CopyText();
});
-->
</script>
For multiple fields into one, just add additional bind functions into $(document).ready and add the field(s) into the filled field's val() like so:
<script type="text/javascript">
<!--
$(document).ready(function(){
function CopyText() {
$('#udf_FieldToBeAutoFilled').val($('#udf_NameOfAEMFieldOnForm\\:NameOfAEMField1').val() + ' ' +
$('#udf_NameOfAEMFieldOnForm\\:NameOfAEMField2').val());
}
$('#udf_NameOfAEMFieldOnForm\\:NameOfAEMField1').bind('change', function(e) { CopyText(); });
$('#udf_NameOfAEMFieldonForm\\:NameOfAEMField2').bind('change', function(e) { CopyText(); });
CopyText();
});
-->
</script>
NO
1. Follow the instruction above, but Copy/Paste the following code into the field new HTML field. Be sure to replace udf_FieldToBeCopied and udf_FieldToBeAutoFilled below.
<script type="text/javascript">
<!--
$(document).ready(function(){
function CopyText() {
$('#udf_FieldToBeAutoFilled').val($('#udf_FieldToBeCopied').val());
}
$('#udf_FieldToBeCopied').bind('change', function(e) {
CopyText();
});
CopyText();
});
-->
</script>