1
I’m creating a screen to add orders. When I choose the date of sale, I would like it to automatically calculate the due date and exchange the value of the maturity field (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>
There are the fields, but I have no idea how to solve this problem. Someone can help me?
If this is of any importance, both date fields open a calendar, but do not restrict the user from writing 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'});
Why not create a Javascript function and invoke it in the event
onblur
of the elementDATA_VENDA
?– felipe.zkn
Unfortunately I tried but for some reason onblur did not work, so I would like an example
– Felipe Song
What makes the function
mascara_data
? You can put it in the question?– Sergio
Added the question, I forgot to add!
– Felipe Song