//carrier wizard added validation fields

This commit is contained in:
Vincent Augagneur committed 2013-07-31 17:33:09 +02:00
1 parent 60ecfaafd2
commit 32f23a79a4
2 files changed
+17 -17

No files matched your search

@@ -23,7 +23,7 @@
<td class="border_top border_bottom border_bold"><span class="fees_all" {if $ranges|count == 0}style="display:none" {/if}>All</span></td> <td class="border_top border_bottom border_bold"><span class="fees_all" {if $ranges|count == 0}style="display:none" {/if}>All</span></td>
<td></td> <td></td>
{foreach from=$ranges key=r item=range} {foreach from=$ranges key=r item=range}
<td class="center border_top border_bottom"> <td class="center border_top border_bottom {if $range.id_range != -1} validated {/if}" >
<input type="text" {if isset($form_id) && !$form_id} disabled="disabled"{/if} {if $range.id_range == -1} style="display:none"{/if} /> <input type="text" {if isset($form_id) && !$form_id} disabled="disabled"{/if} {if $range.id_range == -1} style="display:none"{/if} />
{if $range.id_range == -1} <button class="button">{l s="Validate"}</button> {/if} {if $range.id_range == -1} <button class="button">{l s="Validate"}</button> {/if}
</td> </td>
+16 -16
View File
@@ -208,6 +208,10 @@ function resizeWizard()
function bind_inputs() function bind_inputs()
{ {
$('input').focus( function () {
$(this).removeClass('field_error');
});
$('tr.delete_range td button').off('click').on('click', function () { $('tr.delete_range td button').off('click').on('click', function () {
if (confirm(delete_range_confirm)) if (confirm(delete_range_confirm))
{ {
@@ -316,6 +320,10 @@ function bind_inputs()
} }
}); });
}); });
$('#zones_table td input[type=text]').off('change').on('change', function () {
checkAllFieldIsNumeric();
});
} }
function validateRange(index) function validateRange(index)
@@ -426,27 +434,20 @@ function add_new_range()
return false; return false;
} }
function checkFeesForEnableZone(index)
{
is_ok = true;
$('tr.fees').each( function () {
$(this).find('td:eq('+index+') input').each( function () {
if (!$(this).attr('disabled'))
{
if ($(this).val() == '')
is_ok = false;
}
});
});
return is_ok;
}
function delete_new_range() function delete_new_range()
{ {
if ($('#new_range_form_placeholder').children('td').length = 1) if ($('#new_range_form_placeholder').children('td').length = 1)
return false; return false;
} }
function checkAllFieldIsNumeric()
{
$('#zones_table td input[type=text]').each( function () {
console.log(this);
if (!$.isNumeric($(this).val()) && $(this).val() != '')
$(this).addClass('field_error');
});
}
function rebuildTabindex() function rebuildTabindex()
{ {
@@ -459,7 +460,6 @@ function rebuildTabindex()
j = zones_nbr + j; j = zones_nbr + j;
if ($(this).index() >= 2 && $(this).find('input')) if ($(this).index() >= 2 && $(this).find('input'))
$(this).find('input').attr('tabindex', j); $(this).find('input').attr('tabindex', j);
console.log(j);
}); });
i++; i++;
}); });