Improve inputs auto-focus
This commit is contained in:
parent
3beac92939
commit
78a4e1e3c4
1 changed files with 5 additions and 6 deletions
11
inc/myco.js
11
inc/myco.js
|
@ -559,8 +559,6 @@ on_show_add_contribution_modal=function(e) {
|
|||
displayKey: 'value',
|
||||
source: group.findContributionByTitleMatches()
|
||||
});
|
||||
|
||||
$('#add_contribution_modal #add_contribution_title').focus();
|
||||
}
|
||||
|
||||
populate_add_contribution_categories=function(group,select) {
|
||||
|
@ -596,6 +594,7 @@ on_click_add_contribution_btn=function() {
|
|||
$($('#add_contribution_modal h4')[0]).html('Ajouter une contribution');
|
||||
$($('#add_contribution_modal #add_contribution_submit')[0]).html('Ajouter');
|
||||
$('#add_contribution_modal').modal('show');
|
||||
$('#add_contribution_title').val('').focus();
|
||||
}
|
||||
|
||||
on_valid_add_contribution_modal=function(e) {
|
||||
|
@ -609,18 +608,18 @@ on_valid_add_contribution_modal=function(e) {
|
|||
}
|
||||
var title=$('#add_contribution_title')[0].value;
|
||||
if (title=='') {
|
||||
$('#add_contribution_title')[0].focus();
|
||||
$('#add_contribution_title').focus();
|
||||
alert('Vous devez saisir un titre !');
|
||||
return;
|
||||
}
|
||||
var cost=$('#add_contribution_cost')[0].value;
|
||||
if (cost=='') {
|
||||
$('#add_contribution_cost')[0].focus();
|
||||
$('#add_contribution_cost').focus();
|
||||
alert('Vous devez saisir un coût !');
|
||||
return;
|
||||
}
|
||||
else if(!RegExp('^[0-9]*((,|\.)[0-9]{1,2})*$').test(cost)) {
|
||||
$('#add_contribution_cost')[0].focus();
|
||||
$('#add_contribution_cost').focus();
|
||||
alert('Coût incorrect !');
|
||||
return;
|
||||
}
|
||||
|
@ -630,7 +629,7 @@ on_valid_add_contribution_modal=function(e) {
|
|||
date.replace(/ /g,'');
|
||||
if (date!='') {
|
||||
if(!RegExp('^[0-3][0-9]\/[0-1][0-9]\/[0-2][0-9][0-9][0-9]$').test(date)) {
|
||||
$('#add_contribution_date')[0].focus();
|
||||
$('#add_contribution_date').focus();
|
||||
alert('Date incorrect !');
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue