Pull Symbols from a Phone number? :)


This Discussion is public


Hi Formidable fans!

I am trying to create a hidden field that pulls just the number's out of a phone number field.

So - I have the entry (999)999-9999 - I am trying to find a way for the phone number to pull into a hidden field as strictly numbers 9999999999 -I only want it to do this for the home phone number on the form, not any of the other ones.  I create a dynamic value to pull the phone number in...but cannot remove the ( & - in the phone number=)

I thought I could use this...


<script type="text/javascript">
$('input[name="item_meta[988]"], input[name="item_meta[989]"]').change(function(){
var val = this.value;
if (val !=undefined){
 this.value = newVal.replace(/^d+(.d{0,2})?$/, "");
} }); });

But possible modify it to remove all the characters? Anyone have any idea how I might do this - been banging my head against a wall all day!

I guess my other question is - where do I put it?  Do I place this javascript in the "After fields" section of my form?
(Sorry for my absolute lack of knowledge on this!) Thanks hope everyone is having a great day!

Reply to this Discussion