Projekt

Obecné

Profil

Stáhnout (1.01 KB) Statistiky
| Větev: | Tag: | Revize:
8baed187 Michal Kliment
<?php
/**
* Additional user contact add javascript view.
* Change form during to type of contact.
*
* @author Ondřej Fibich
*/

// IDE complementation
if (FALSE): ?><script type="text/javascript"><?php endif

?>

var country_code_dropdown = $('.country_code');
c1bdc1c4 Michal Kliment
var mail_redirection_checkbox = $('.mail_redirection');
8baed187 Michal Kliment
$('#type_dropdown').live('change', function () {
var type = parseInt($(this).val(), 10);
$("#value").removeClass('number email');
$("#value").removeAttr('minlength');

switch (type)
{
case <?php echo Contact_Model::TYPE_PHONE ?>:
country_code_dropdown.show();
c1bdc1c4 Michal Kliment
mail_redirection_checkbox.hide();
8baed187 Michal Kliment
$("#value").addClass('number');
$("#value").attr('minlength',9);
break;
case <?php echo Contact_Model::TYPE_EMAIL ?>:
country_code_dropdown.hide();
c1bdc1c4 Michal Kliment
mail_redirection_checkbox.show();
8baed187 Michal Kliment
$("#value").addClass('email');
break;
default:
country_code_dropdown.hide();
c1bdc1c4 Michal Kliment
mail_redirection_checkbox.hide();
8baed187 Michal Kliment
}
});
$('#type_dropdown').trigger('change');