I'm creating a screen to add orders. When I choose the date of the sale, I would like it to automatically calculate the due date and change the maturity field value (which is always 180 days after the date of purchase).
<table>
<tr>
<td align='left'> Valor do Pedido : </td>
<td align='left'><input style="width: 115px;" id="VALOR_PEDIDO" required value="" name="VALOR_PEDIDO" type='text' maxlength='100' tabindex='5' size='30'/></td>
<td align='left'> Data da venda : </td>
<td align='left'><input style="width: 115px;" id="DATA_VENDA" required value="" name="DATA_VENDA" type="us-date0" OnKeyUp="mascara_data(this.value)" type='text' maxlength='10' tabindex='5' size='30'/></td>
<td align='left'> Data de vencimento EBS : </td>
<td align='left'><input style="width: 115px;" id="DATA_VENC_EBS" required value="" name="DATA_VENC_EBS" type="us-date0" OnKeyUp="mascara_data(this.value)" type='text' maxlength='10' tabindex='5' size='30'/></td>
</tr>
</table>
Here are the fields, but I have no idea how to solve this problem. Can anyone help me?
If this is of any importance, both date fields open a calendar, but do not restrict the user from typing in the field.
var month = (new Date()).getMonth() + 1;
var year = (new Date()).getFullYear();
$('input[type=us-date0]').w2field('date', {format: 'dd/mm/yyyy', placeholder: 'dd/mm/aaaa'});