Regular Expressions Help #2 - Page 1...

User 2947074 Photo


Registered User
27 posts

Hi,

I need some help, I'm using Regular Expressions using numbers in Form Builder. I would like when someone enter their phone number they have dashes between the numbers and when they get a confirmation email they only see the Last four numbers and the rest are X's. How would I write in the custom /^[0-9]+$/.
Example: They see 888-888-8888 when they fill the form out.
But the confirmation email looks like xxx-xxx-xxxx or xxx-xxx-8888. If any help. Thank You!
User 187934 Photo


Senior Advisor
19,573 posts

Hi GG,
I would add another input that's hidden and use JQuery to fill that in with the value in the format you want.
Then in the Confirmation email use individual variables instead of the form results.
example:
[_form_results_] would report all variables.
[phone_xxx] would be one input named phone_xxx.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2947074 Photo


Registered User
27 posts

Is their another way just to be easier for me just to use the custom /^[0-9]+$/. I don't have to go all in detail and finding the value input?
User 187934 Photo


Senior Advisor
19,573 posts

There's not really a way to manipulate the data unless you want to hack into the backend php or build a custom confirmation page that you use the custom redirect option on and then use the $_SESSION variables with some php code to display what you want.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2947074 Photo


Registered User
27 posts

Just wondering what is the custom /^[0-9]+$/ for? If you dont mind me asking.
User 187934 Photo


Senior Advisor
19,573 posts

That's a Regex to allow only entering numbers from 0 to 9.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2947074 Photo


Registered User
27 posts

Kinda thought so. I'll just my best to figure it out with JQuery, but if not Ill just leave it alone and let it stay how it is. I might need some question the further. But Thank You!:)
User 187934 Photo


Senior Advisor
19,573 posts

Give me a second to upload an example to my server.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script>// ver 1
var jQ = $.noConflict(true);
jQ(document).ready(function(){
// ****Uncomment the line below after testing code *** //
//jQ('input[name*="email_xxx"]').parent().parent('[id^="item"]').css('display','none');
jQ("input[name='phone']").on('change', function() {
var phone = jQ(this).val();
var regex = /\d(?:(?:\D*\d){4})/gm;
var subst = 'x';
var phone_xxx = phone.replace(regex, subst);
jQ("input[name='phone_xxx']").val(phone_xxx);
});
});</script>
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 187934 Photo


Senior Advisor
19,573 posts

See if this is close.
http://ericrohloff.com/coffeecup/ccforu … umber.html
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2947074 Photo


Registered User
27 posts

That's perfect. That what im looking for. Where would I put that scripts on my html fragment?

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.