diff options
-rw-r--r-- | app/assets/javascripts/call_forward.js | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/app/assets/javascripts/call_forward.js b/app/assets/javascripts/call_forward.js index 744fae0..13c5679 100644 --- a/app/assets/javascripts/call_forward.js +++ b/app/assets/javascripts/call_forward.js @@ -16,43 +16,46 @@ var voicemail_pattern = /VoicemailAccount$/; - if($('#call_forward_call_forwarding_destination').val() == ":PhoneNumber"){ - $("#destination_phone_number").attr('name', 'call_forward[destination]'); - $("#destination_greeting").attr('name', 'disabled'); - $("#destination_phone_number_div").css('display','block'); - $("#destination_greeting_div").css('display','none'); + if($('#call_forward_call_forwarding_destination').val()) { - } - else if ($('#call_forward_call_forwarding_destination').val().match(voicemail_pattern)){ - $("#destination_phone_number").attr('name', 'disabled'); - $("#destination_greeting").attr('name', 'call_forward[destination]'); - $("#destination_phone_number_div").css('display','none'); - $("#destination_greeting_div").css('display','block'); - } - else { - $("#destination_phone_number").attr('name', 'disabled'); - $("#destination_greeting").attr('name', 'disabled'); - $("#destination_phone_number_div").css('display','none'); - $("#destination_greeting_div").css('display','none'); - } - $('#call_forward_call_forwarding_destination').change(function(){ - if($(this).val() == ":PhoneNumber"){ + if($('#call_forward_call_forwarding_destination').val() == ":PhoneNumber"){ $("#destination_phone_number").attr('name', 'call_forward[destination]'); $("#destination_greeting").attr('name', 'disabled'); $("#destination_phone_number_div").css('display','block'); $("#destination_greeting_div").css('display','none'); - } + + } else if ($('#call_forward_call_forwarding_destination').val().match(voicemail_pattern)){ $("#destination_phone_number").attr('name', 'disabled'); $("#destination_greeting").attr('name', 'call_forward[destination]'); $("#destination_phone_number_div").css('display','none'); $("#destination_greeting_div").css('display','block'); - } - else{ + } + else { $("#destination_phone_number").attr('name', 'disabled'); $("#destination_greeting").attr('name', 'disabled'); $("#destination_phone_number_div").css('display','none'); $("#destination_greeting_div").css('display','none'); - } - }) + } + $('#call_forward_call_forwarding_destination').change(function(){ + if($(this).val() == ":PhoneNumber"){ + $("#destination_phone_number").attr('name', 'call_forward[destination]'); + $("#destination_greeting").attr('name', 'disabled'); + $("#destination_phone_number_div").css('display','block'); + $("#destination_greeting_div").css('display','none'); + } + else if ($('#call_forward_call_forwarding_destination').val().match(voicemail_pattern)){ + $("#destination_phone_number").attr('name', 'disabled'); + $("#destination_greeting").attr('name', 'call_forward[destination]'); + $("#destination_phone_number_div").css('display','none'); + $("#destination_greeting_div").css('display','block'); + } + else{ + $("#destination_phone_number").attr('name', 'disabled'); + $("#destination_greeting").attr('name', 'disabled'); + $("#destination_phone_number_div").css('display','none'); + $("#destination_greeting_div").css('display','none'); + } + }) + } }); |