I've never been able to find a way to do that with just formulas. Forms trims a lot of stuff by default, and even when I try putting in the character code for a white space (using the approach you tried as well as CONCATENATE) it always trims (leading and trailing) white spaces for each item being concatenated.
The only way I've been able to accomplish this is with JavaScript. I even tried concatenating the values with a placeholder then using SUBSTITUTE on the combined text and it still removed the white space. Not sure if this is a bug, or if it meant to be that way.
First, change the " " in your concatenation to a "_" (or any character you choose) so you have a placeholder to identify and manipulate.
=CONCATENATE(FirstName, IF(TRIM(LastName)="","","_"), LastName)
NOTE: the "IF" condition is in there so it will only add the placeholder (and therefore the space) if there is actually something to put after the FirstName.
Then, in the JavaScript for the form use the following:
$(document).ready(function(){
// Assign a change event to detect changes to the concatenated field
$('#YourField input').change(function(){
// Replace your placeholder with a space
$(this).val($(this).val().replace('_',' '));
});
});
And every time the field changes, it will look for the "_" (or whatever placeholder you choose) and replace it with a white space.