Fix: best practice
This commit is contained in:
parent
80eceab230
commit
16ad953d10
@ -20,23 +20,20 @@
|
|||||||
<!-- BEGIN PHP TEMPLATE admin_extrafields.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE admin_extrafields.tpl.php -->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
function init_typeoffields()
|
function init_typeoffields(type)
|
||||||
{
|
{
|
||||||
var type = jQuery("#type").val();
|
|
||||||
var size = jQuery("#size");
|
var size = jQuery("#size");
|
||||||
|
|
||||||
if (type == 'date') { size.val('').attr('disabled','disabled'); }
|
if (type == 'date') { size.val('').attr('disabled','disabled'); }
|
||||||
else if (type == 'datetime') { size.val('').attr('disabled','disabled'); }
|
else if (type == 'datetime') { size.val('').attr('disabled','disabled'); }
|
||||||
else if (type == 'double') { size.val('24,8').removeAttr('disabled'); }
|
else if (type == 'double') { size.val('24,8').removeAttr('disabled'); }
|
||||||
else if (type == 'int') { size.val('10').removeAttr('disabled'); }
|
else if (type == 'int') { size.val('10').removeAttr('disabled'); }
|
||||||
else if (type == 'text') { size.val('2000').removeAttr('disabled'); }
|
else if (type == 'text') { size.val('2000').removeAttr('disabled'); }
|
||||||
else if (type == 'varchar') { size.val('255').removeAttr('disabled'); }
|
else if (type == 'varchar') { size.val('255').removeAttr('disabled'); }
|
||||||
else if (type == '') { size.val('').attr('disabled','disabled'); }
|
else size.val('').attr('disabled','disabled');
|
||||||
else size.attr('disabled','disabled');
|
|
||||||
}
|
}
|
||||||
init_typeoffields();
|
init_typeoffields();
|
||||||
jQuery("#type").change(function() {
|
jQuery("#type").change(function() {
|
||||||
init_typeoffields();
|
init_typeoffields($(this).val());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user