Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Commit

Permalink
validation of the date when less than ten
Browse files Browse the repository at this point in the history
  • Loading branch information
andrecristiani committed Mar 20, 2018
1 parent 4ba98e6 commit 45d83c3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ $url = $obj->getUrl('pagseguro/adminhtml_conciliation');
</tr>
<tr>
<th width="8%" class="input-search">
<input type="text" class="pagseguro-field" name="date_begin" id="date_begin" OnKeyUp="dateMask(this.value, 'date_begin')" maxlength="10" placeholder="De"/>
<input type="text" class="pagseguro-field input-date" name="date_end" id="date_end" OnKeyUp="dateMask(this.value, 'date_end')" maxlength="10" placeholder="Até"/>
<input type="text" class="pagseguro-field" name="date_begin" id="date_begin" OnKeyUp="dateMask(this.value, 'date_begin')" onblur="dateVerifyOnLosesFocus(this)" maxlength="10" placeholder="De"/>
<input type="text" class="pagseguro-field input-date" name="date_end" id="date_end" OnKeyUp="dateMask(this.value, 'date_end')" onblur="dateVerifyOnLosesFocus(this)" maxlength="10" placeholder="Até"/>
</th>
<th width="20%" class="input-search"><input type="text" class="pagseguro-field" name="id_magento" id="id_magento" placeholder="ID Magento"/></th>
<th width="35%" class="input-search"><input type="text" class="pagseguro-field" name="id_pagseguro" id="id_pagseguro" placeholder="ID PagSeguro"/></th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,19 @@ function dateMask (date, fieldName) {
if (field.value == "") {
field.classList.remove('pagseguro-field-error');
}
}

}

function dateVerifyOnLosesFocus(fieldName){
var mydate = '';
mydate = mydate + fieldName.value;

if(mydate.length > 0 && mydate.length < 10){
fieldName.classList.add('pagseguro-field-error');
}else{
dateVerify(fieldName);
}
}

function dateVerify (field) {

day = (field.value.substring(0,2));
Expand Down

0 comments on commit 45d83c3

Please sign in to comment.