This topic is locked

Calculate date field on the fly

10/27/2011 5:39:09 AM
PHPRunner General questions
L
loryese author

I have a table which has 2 DATE fields ().

On the "add record" form i would like to have the second date field([font="Courier New"]taxa_expira) to be calculated on the fly, after the first field its inserted ().
I've tried the following code in the "[font="Courier New"]Javascript OnLoad event", but its not working. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=18030&image=1&table=forumtopics' class='bbc_emoticon' alt=':unsure:' /> (I'm using Simple edit box with datepicker)



var ctrlData = Runner.getControl(pageid, 'taxa_date');
var ctrlExpiry = Runner.getControl(pageid, 'taxa_expira');


function func() {
if ( ctrlData.getDate()!='' && !isNaN(ctrlData.getDate()))
ctrlExpira.setDate(ctrlData.getDate()+365);
else
ctrlExpira.setDate('');
};
ctrlData.on('keyup', func);


Pls help <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=18030&image=2&table=forumtopics' class='bbc_emoticon' alt=':unsure:' />