//carrier wizard steps validation error
This commit is contained in:
@@ -451,7 +451,7 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
2 => array('is_free', 'id_tax_rules_group', 'shipping_handling', 'shipping_method', 'range_behavior'),
|
||||
3 => array('range_behavior', 'max_height', 'max_width', 'max_depth', 'max_weight'),
|
||||
);
|
||||
|
||||
$rules = array();
|
||||
switch ($step_number)
|
||||
{
|
||||
case 1:
|
||||
@@ -461,7 +461,7 @@ class AdminCarrierWizardControllerCore extends AdminController
|
||||
$rules = Carrier::getValidationRules('Carrier');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
foreach ($rules as $key_r => $rule)
|
||||
foreach ($rule as $key_f => $field)
|
||||
if (!in_array($field, $step_fields[$step_number]))
|
||||
|
||||
+6
-4
@@ -2403,7 +2403,7 @@ margin-bottom:7px;
|
||||
|
||||
#carrier_wizard.swMain ul.anchor li{
|
||||
margin-bottom:10px;
|
||||
background: transparent url(../img/admin/steps-carrierwizard.png) no-repeat 0 0;
|
||||
background: transparent url(../img/admin/steps-carrierwizard.png) no-repeat 0 0!important;
|
||||
border: medium none;
|
||||
padding-left: 0;
|
||||
width:auto;
|
||||
@@ -2414,9 +2414,9 @@ margin-bottom:7px;
|
||||
#carrier_wizard.swMain ul.nbr_steps_4 li{min-width: 21.6%;}
|
||||
#carrier_wizard.swMain ul.nbr_steps_5 li{ min-width: 16.6%;}
|
||||
|
||||
#carrier_wizard.swMain ul.anchor li.disabled{background: transparent url(../img/admin/steps-carrierwizard.png) no-repeat right -64px;}
|
||||
#carrier_wizard.swMain ul.anchor li.selected{background: transparent url(../img/admin/steps-carrierwizard.png) no-repeat right -32px;}
|
||||
#carrier_wizard.swMain ul.anchor li.done{background: transparent url(../img/admin/steps-carrierwizard.png) no-repeat right 0;}
|
||||
#carrier_wizard.swMain ul.anchor li.disabled{background: transparent url(../img/admin/steps-carrierwizard.png) no-repeat right -64px!important;}
|
||||
#carrier_wizard.swMain ul.anchor li.selected{background: transparent url(../img/admin/steps-carrierwizard.png) no-repeat right -32px!important;}
|
||||
#carrier_wizard.swMain ul.anchor li.done{background: transparent url(../img/admin/steps-carrierwizard.png) no-repeat right 0!important;}
|
||||
|
||||
#carrier_wizard.swMain ul.anchor li a{
|
||||
padding: 3px 20px;
|
||||
@@ -2500,3 +2500,5 @@ margin-bottom:7px;
|
||||
.border_bottom {border-bottom:solid 1px #C0C0C0;}
|
||||
.border_left {border-left:solid 1px #C0C0C0;}
|
||||
.border_right {border-right:solid 1px #C0C0C0;}
|
||||
|
||||
#carrier_wizard input.field_error {border : solid 1px red; background-color:#FFCCCC}
|
||||
+17
-25
@@ -56,48 +56,40 @@ function leaveStepCallback(obj, context)
|
||||
return validateSteps(context.fromStep); // return false to stay on step and true to continue navigation
|
||||
}
|
||||
|
||||
function validateSteps(step_number){
|
||||
var step_valid = true;
|
||||
|
||||
function validateSteps(step_number)
|
||||
{
|
||||
var is_ok = true;
|
||||
form = $('#carrier_wizard #step-'+step_number+' form');
|
||||
|
||||
/*
|
||||
switch(step_number)
|
||||
{
|
||||
case 1:
|
||||
|
||||
break;
|
||||
case 2:
|
||||
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url : validate_url,
|
||||
async: true,
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
data : form.serialize()+'&step_number='+step_number+'&action=validate_step&ajax=1',
|
||||
success : function(datas)
|
||||
{
|
||||
if (datas.has_error)
|
||||
{
|
||||
is_ok = false;
|
||||
$('#wizard_error').remove();
|
||||
|
||||
$('input').focus( function () {
|
||||
$(this).removeClass('field_error');
|
||||
});
|
||||
|
||||
str_error = '<div class="error" id="wizard_error"><span style="float:right"><a id="hideError" href="#"><img alt="X" src="../img/admin/close.png" /></a></span><ul>';
|
||||
for (var error in datas.errors)
|
||||
{
|
||||
$('#carrier_wizard').smartWizard('setError',{stepnum:step_number,iserror:true});
|
||||
$('input[name="'+error+'"]').css({'border' : 'solid 1px red', 'background-color' : '#FFCCCC'});
|
||||
$("#carrier_wizard")
|
||||
|
||||
$('input[name="'+error+'"]').addClass('field_error');
|
||||
str_error += '<li>'+datas.errors[error]+'</li>';
|
||||
}
|
||||
return false;
|
||||
$('#step-'+step_number).prepend(str_error+'</ul></div>');
|
||||
resizeWizard();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
return true;
|
||||
return is_ok;
|
||||
}
|
||||
|
||||
function resizeWizard()
|
||||
|
||||
Reference in New Issue
Block a user