I'm fairy new to Adobe forms scripting, but I've managed to get by so far. I'm currently working on a form that we send out to suppliers to set them up in our systems.
One of the fields is called "Organisation Name", this has a custom format script which changes the entered text to uppercase on field exit:
event.value = event.value.toUpperCase();
I have a hidden field "Clean Organsation Name" which is a calculated organistion code that we use to identify the organisation within our systems (which can only use letter characters). I need "Clean Organisation Name" to be a calculation of "Organisation Name" with all spaces and non-standard characters removed ( ", ()@$'&.....etc).
Could someone help me out with this?
Many thanks in advance
This should do the trick:
event.value = this.getField("Organisation Name").valueAsString.replace(/[\W,_]/g,"");