I know that this is an old thread but thought it might be worth pointing out that you can use both Clayton's and Hilary's methods together. I wanted to allow my users to enter free, human-readable text in a field that gets used in the filename for browser-enabled forms in SharePoint. Spaces inflate the filename and special characters can interrupt the URL when you send links to the form by e-mail alerts so I needed a way to consume the user's entry and store it in a field with no spaces or special characters outside of hyphens, underscores and decimals that gets concatenated to a time stamp to form a filename. The answer was simple; the hidden field has a default value of:
translate(../my:FieldName, "~!@#$%^&*()+=;'<>?,{}[]|\ ", "")