10 years ago
2
Topic
Hi all,
I use this solution to get correct phone numbers during user registration/changing profile.
Here is an working demo http://jsfiddle.net/terveg/fxJe4/4/ which demonstrates the idea

Situation
  1. there is a dynamic (cascade) select in form with only one result option (for example COUNTRY->COUNTRY PHONECODE). 
  2. To make this one option selected by default when user chooses COUNTRY i use stuff->custom attributes-> selected="selected"
  3. I have also user_phone which is input field with JS mask, where user can fill number
  4. I have 3rd field - input which is the resulting field. To copy text values into this field, I use jquery script in stuff->Script (JS)
What it does:
if country is changed/chosen ->child field "phonecode" get selected (so we can get text option from it). This code "is copied" into the result field. 
Phonecode changes automatically, when country is changed and also automatically is "copied" into results again.
Meanwhile user type number...and these numbers is being copied into the result field as stated in JS.
If something is changed - it is updating in the result field.

Hope this helps.
Regards.












Get a VIP membership
693 Posts
rpoy
10 years ago
0
Level 1
Hi Jay,

Nice Idea, thank you for the post!

Randy
17 Posts
kolydart
9 years ago
0
Level 1

Thank you very much!

One small question. Why do you repeat the auto-type function inside of itself?

I mean that when

$('#user_code, #user_phone').bind('change keyup keydown', function () is called

there is a function with the same result inside

$('#user_code, #user_phone').change('keyup keydown', function ()

thanks again!

Get a Book for SEBLOD