// Fix attr('checked'), attr('disabled') and attr('selected') with jquery update #PSCFV-2142

This commit is contained in:
rMalie
2012-05-02 08:29:30 +00:00
parent faea9caafb
commit d0b4e96ab3
17 changed files with 43 additions and 43 deletions

View File

@@ -394,7 +394,7 @@
function disableConstraint()
{
$('#constraint').attr('disabled', 'disabled');
$('#constraint').attr('disabled', true);
};
function ShowHandlers()
{
@@ -496,7 +496,7 @@
*/
function cancelChangeMode()
{
$('#formAction input[@value=' + $('#image_mode').val() + ']').attr('checked', 'checked');
$('#formAction input[@value=' + $('#image_mode').val() + ']').attr('checked', true);
};
/**
* get the image element which is going to be modified
@@ -669,7 +669,7 @@ function toggleDisabledButton(buttonId, forceDisable)
if(forceDisable && currentClass == 'button')
{
newClass = 'disabledButton';
$(disabledButton).attr('disabled', 'disabled');
$(disabledButton).attr('disabled', true);
}else if(!forceDisable && currentClass == 'disabledButton')
{
newClass = 'button';
@@ -684,7 +684,7 @@ function toggleDisabledButton(buttonId, forceDisable)
else if(currentClass == 'button')
{
newClass = 'disabledButton';
$(disabledButton).attr('disabled', 'disabled');
$(disabledButton).attr('disabled', true);
}else
{
newClass = 'button';

View File

@@ -223,13 +223,13 @@ $('#cart_rule_form').submit(function() {
else
{
$('#' + restrictions[i] + '_select_2 option').each(function(i) {
$(this).attr('selected', 'selected');
$(this).attr('selected', true);
});
}
}
$('.product_rule_toselect option').each(function(i) {
$(this).attr('selected', 'selected');
$(this).attr('selected', true);
});
});

View File

@@ -43,7 +43,7 @@
if (r == 'ok')
{
$('#note_feedback').html("<b style='color:green'>{l s='Your note has been saved'}</b>").fadeIn(400);
$('#submitCustomerNote').attr('disabled', 'disabled');
$('#submitCustomerNote').attr('disabled', true);
}
else if (r == 'error:validation')
$('#note_feedback').html("<b style='color:red'>({l s='Error: your note is not valid'}</b>").fadeIn(400);

View File

@@ -97,7 +97,7 @@
if (!val || val == {$smarty.const._PS_ADMIN_PROFILE_})
{
$('.assoShop input[type=checkbox]').attr('disabled', true);
$('.assoShop input[type=checkbox]').attr('checked', 'checked');
$('.assoShop input[type=checkbox]').attr('checked', true);
}
else
$('.assoShop input[type=checkbox]').attr('disabled', false);

View File

@@ -77,7 +77,7 @@
else
{
$(elt).addClass('select_all').removeClass('unselect_all');
$('ul#sortable_module_'+$(elt).attr('id')).find('input[type="checkbox"]').attr('checked', 'checked');
$('ul#sortable_module_'+$(elt).attr('id')).find('input[type="checkbox"]').attr('checked', true);
$(elt).html('{l s='Unselect all'}');
}
}

View File

@@ -625,11 +625,11 @@
updateDeliveryOptionList(jsonSummary.delivery_option_list);
if (jsonSummary.cart.gift == 1)
$('#order_gift').attr('checked', 'checked');
$('#order_gift').attr('checked', true);
else
$('#carrier_gift').removeAttr('checked');
if (jsonSummary.cart.recyclable == 1)
$('#carrier_recycled_package').attr('checked', 'checked');
$('#carrier_recycled_package').attr('checked', true);
else
$('#carrier_recycled_package').removeAttr('checked');
$('#gift_message').html(jsonSummary.cart.gift_message);
@@ -645,11 +645,11 @@
$('#total_products').html(jsonSummary.summary.total_products);
id_currency = jsonSummary.cart.id_currency;
$('#id_currency option').removeAttr('selected');
$('#id_currency option[value="'+id_currency+'"]').attr('selected', 'selected');
$('#id_currency option[value="'+id_currency+'"]').attr('selected', true);
updateCurrencySign();
id_lang = jsonSummary.cart.id_lang;
$('#id_lang option').removeAttr('selected');
$('#id_lang option[value="'+id_lang+'"]').attr('selected', 'selected');
$('#id_lang option[value="'+id_lang+'"]').attr('selected', true);
$('#send_email_to_customer').attr('rel', jsonSummary.link_order);
$('#go_order_process').attr('href', jsonSummary.link_order);
$('#order_message').val(jsonSummary.order_message);

View File

@@ -44,7 +44,7 @@
event.preventDefault();
$('#block_category_tree').toggle();
if ($('#block_category_tree').is(':visible'))
$(this).find('input').attr('checked', 'checked');
$(this).find('input').attr('checked', true);
else
{
$(this).find('input').removeAttr('checked');

View File

@@ -35,14 +35,14 @@
if (disabled_customer || disabled_stock)
{
$("input[name=share_order]").each(function(i) {
$(this).attr('disabled', 'disabled');
$(this).attr('disabled', true);
});
$('#share_order_off').attr('checked', true);
}
else
{
$('input[name=share_order]').attr('disabled', '');
$('input[name=share_order]').attr('disabled', false);
}
}

View File

@@ -223,13 +223,13 @@ $(document).ready(function() {
new_condition_group();
{foreach from=$condition_group item='condition'}
{if $condition.type == 'attribute'}
$('#id_attribute_group option[value="{$condition.id_attribute_group}"]').attr('selected', 'selected');
$('#id_attribute_{$condition.id_attribute_group} option[value="{$condition.value}"]').attr('selected', 'selected');
$('#id_attribute_group option[value="{$condition.id_attribute_group}"]').attr('selected', true);
$('#id_attribute_{$condition.id_attribute_group} option[value="{$condition.value}"]').attr('selected', true);
{elseif $condition.type == 'feature'}
$('#id_feature[value="{$condition.id_feature}"]').attr('selected', 'selected');
$('#id_feature_{$condition.id_feature} option[value="{$condition.value}"]').attr('selected', 'selected');
$('#id_feature[value="{$condition.id_feature}"]').attr('selected', true);
$('#id_feature_{$condition.id_feature} option[value="{$condition.value}"]').attr('selected', true);
{else}
$('#id_{$condition.type} option[value="{$condition.value}"]').attr('selected', 'selected');
$('#id_{$condition.type} option[value="{$condition.value}"]').attr('selected', true);
{/if}
$('#add_condition_{$condition.type}').click();
{/foreach}

View File

@@ -203,7 +203,7 @@ function checkAllCategories()
else
{
$('input[name="categoryBox[]"]').not(':checked').each(function () {
$(this).attr('checked', 'checked');
$(this).attr('checked', true);
clickOnCategoryBox($(this));
});
}
@@ -352,7 +352,7 @@ function checkCategory()
}
else
{
$('li#'+category_to_check+' > input').attr('checked', 'checked');
$('li#'+category_to_check+' > input').attr('checked', true);
updateNbSubCategorySelected($('li#'+category_to_check+' > input[type=checkbox]'), true);
}
}

View File

@@ -740,12 +740,12 @@ product_tabs['Informations'] = new function(){
$("#available_for_order").click(function(){
if ($(this).is(':checked') || !$('input[name=\'multishop_check[show_price]\']').prop('checked'))
{
$('#show_price').attr('checked', 'checked');
$('#show_price').attr('disabled', 'disabled');
$('#show_price').attr('checked', true);
$('#show_price').attr('disabled', true);
}
else
{
$('#show_price').attr('disabled', '');
$('#show_price').attr('disabled', false);
}
});
};
@@ -782,17 +782,17 @@ product_tabs['Informations'] = new function(){
this.switchProductType = function(){
if (product_type == product_type_pack)
{
$('#pack_product').attr('checked', 'checked');
$('#pack_product').attr('checked', true);
}
else if (product_type == product_type_virtual)
{
$('#virtual_product').attr('checked', 'checked');
$('#condition').attr('disabled', 'disabled');
$('#condition option[value=new]').attr('selected', 'selected');
$('#virtual_product').attr('checked', true);
$('#condition').attr('disabled', true);
$('#condition option[value=new]').attr('selected', true);
}
else
{
$('#simple_product').attr('checked', 'checked');
$('#simple_product').attr('checked', true);
}
$('input[name="type_product"]').live('click', function()
@@ -813,11 +813,11 @@ product_tabs['Informations'] = new function(){
{
//when you change the type of the product, directly go to the pack tab
$('li.tab-row a[id*="Pack"]').show().click();
$('#ppack').val(1).attr('checked', true).attr('disabled', 'disabled');
$('#ppack').val(1).attr('checked', true).attr('disabled', true);
$('#ppackdiv').show();
// If the pack tab has not finished loaded the changes will be made when the loading event is triggered
$("#product-tab-content-Pack").bind('loaded', function(){
$('#ppack').val(1).attr('checked', true).attr('disabled', 'disabled');
$('#ppack').val(1).attr('checked', true).attr('disabled', true);
$('#ppackdiv').show();
});
$("#product-tab-content-Quantities").bind('loaded', function(){
@@ -834,7 +834,7 @@ product_tabs['Informations'] = new function(){
{
if (has_combinations)
{
$('#simple_product').attr('checked', 'checked');
$('#simple_product').attr('checked', true);
$('#warn_virtual_combinations').show();
}
else
@@ -854,7 +854,7 @@ product_tabs['Informations'] = new function(){
$('li.tab-row a[id*="Shipping"]').hide();
tabs_manager.onLoad('Informations', function(){
$('#condition').attr('disabled', 'disabled');
$('#condition').attr('disabled', true);
$('#condition option[value=refurbished]').removeAttr('selected');
$('#condition option[value=used]').removeAttr('selected');
});
@@ -905,7 +905,7 @@ product_tabs['Pack'] = new function(){
this.bindPackEvents = function (){
if ($('#ppack').prop('checked'))
{
$('#ppack').attr('disabled', 'disabled');
$('#ppack').attr('disabled', true);
$('#ppackdiv').show();
}

View File

@@ -344,7 +344,7 @@ function init()
{
$('tr#new_product input, tr#new_product select').each(function() {
if ($(this).attr('id') != 'add_product_product_name')
$('tr#new_product input, tr#new_product select').attr('disabled', 'disabled');
$('tr#new_product input, tr#new_product select').attr('disabled', true);
});
}
else

View File

@@ -184,11 +184,11 @@ var ajaxCart = {
//disabled the button when adding to do not double add if user double click
if (addedFromProductPage)
{
$('body#product p#add_to_cart input').attr('disabled', 'disabled').removeClass('exclusive').addClass('exclusive_disabled');
$('body#product p#add_to_cart input').attr('disabled', true).removeClass('exclusive').addClass('exclusive_disabled');
$('.filled').removeClass('filled');
}
else
$(callerElement).attr('disabled', 'disabled');
$(callerElement).attr('disabled', true);
if ($('#cart_block #cart_block_list').hasClass('collapsed'))
this.expand();

View File

@@ -412,7 +412,7 @@ function reloadContent(params_plus)
val = $('#pagination #nb_item').val();
$('#pagination #nb_item').children().each(function(it, option) {
if (option.value == val)
$(option).attr('selected', 'selected');
$(option).attr('selected', true);
else
$(option).removeAttr('selected');
});

View File

@@ -45,7 +45,7 @@ countriesNeedZipCode = new Array();
{/if}
{/foreach}
$(function(){ldelim}
$('.id_state option[value={if isset($smarty.post.id_state)}{$smarty.post.id_state}{else}{if isset($address->id_state)}{$address->id_state|escape:'htmlall':'UTF-8'}{/if}{/if}]').attr('selected', 'selected');
$('.id_state option[value={if isset($smarty.post.id_state)}{$smarty.post.id_state}{else}{if isset($address->id_state)}{$address->id_state|escape:'htmlall':'UTF-8'}{/if}{/if}]').attr('selected', true);
{rdelim});
{if $vat_management}
{literal}

View File

@@ -50,7 +50,7 @@ countriesNeedZipCode = new Array();
{/foreach}
{/if}
$(function(){ldelim}
$('.id_state option[value={if isset($smarty.post.id_state)}{$smarty.post.id_state}{else}{if isset($address)}{$address->id_state|escape:'htmlall':'UTF-8'}{/if}{/if}]').attr('selected', 'selected');
$('.id_state option[value={if isset($smarty.post.id_state)}{$smarty.post.id_state}{else}{if isset($address)}{$address->id_state|escape:'htmlall':'UTF-8'}{/if}{/if}]').attr('selected', true);
{rdelim});
//]]>
{if $vat_management}

View File

@@ -703,7 +703,7 @@ function checkUrl()
count++;
// add class 'selected' to the selected color
$('#color_'+attributesCombinations[a]['id_attribute']).addClass('selected');
$('input:radio[value='+attributesCombinations[a]['id_attribute']+']').attr('checked', 'checked');
$('input:radio[value='+attributesCombinations[a]['id_attribute']+']').attr('checked', true);
$('input:hidden[name=group_'+attributesCombinations[a]['id_attribute_group']+']').val(attributesCombinations[a]['id_attribute']);
$('select[name=group_'+attributesCombinations[a]['id_attribute_group']+']').val(attributesCombinations[a]['id_attribute']);
}