I am using the phone number mask to format data for a number of fields. In the case where the field is an output field, if the data is null the field displays as "(&nb) sp;". I assume this is because webmaker adds the non-breaking space so the div or span has content. Is there any way to fix these output fields so they show as empty when no data is returned?
RE: Issue with output element having a display mask
You are correct in your assumption.
If you are OK with the field being shown as ( ) for empty values, then you could use a workaround by changing the page display binding xpath to:
concat(/mvc:eForm/mvc :D ata/mvc:formData/mvc:output[. != ''],' ')
Change the xpath shown to the name of your field.
RE: Issue with output element having a display mask
Can you confirm the WebMaker Version you are using? We may be able to suggest a better script approach that doesn't need xpaths changed.
RE: Issue with output element having a display mask
RE: Issue with output element having a display mask
OK. That means you will have dojo 1.7 upwards.
Create a javascript file for your project called perhaps "fix_output_mask.js" and attach it on the Application Map.
Then add the following code to the script file. This will convert the ???+? to empty value. This should fix any output fields that use any mask variations.
require(['dojo/aspect'], function(aspect) { aspect.before(hyf.validation, 'applyMask', function(control) { if ((control.getAttribute('_use') == 'output') && (control.innerHTML == ' ')) control.innerHTML = ''; }); });
RE: Issue with output element having a display mask