babelfish
10-06-2008, 04:45 PM
Hi all,
im using a free dhtml calendar (from epoch) and have had no problems up to now.
the issue is that you initiate the calendar's relationship with a field in an onload event. such as:
<script type="text/javascript">
var reqdate_cal, plant_off_date_cal, plant_off_date_cal, itemreqdate_cal; //calendar popups!
window.onload = function () {
reqdate_cal = new Epoch('epoch_popup','popup',document.getElementById('reqdate'));
plant_off_date_cal = new Epoch('epoch_popup','popup',document.getElementById('plant_off_date'));
plant_on_date_cal = new Epoch('epoch_popup','popup',document.getElementById('plant_on_date'));
itemreqdate_cal = new Epoch('epoch_popup','popup',document.getElementById('itemreqdate'));
}
</script>
basically this sets up so that if you click on say, 'itemreqdate' field a new object is created.
due to the fact that i am using ajax to create more fields that need this relationship i need a way to get new lines into the onload.
the code i have on the bottom of the returned ajax is:
<script>
var oldWindowOnload = window.onload;
window.onload = function(e) {
if(oldWindowOnload) oldWindowOnload(e);
<php loops thru all fields>
echo "var itemreqdate{$row['id']}_cal = new Epoch('epoch_popup','popup',document.getElementById('itemreqdate{$row['id']}'));";
<end of php looping>
}
<script>
the 'var oldWindowOnload = window.onload' section just stops the first set of onload events being overwritten by the new set.
any ideas? im stumped...
im using a free dhtml calendar (from epoch) and have had no problems up to now.
the issue is that you initiate the calendar's relationship with a field in an onload event. such as:
<script type="text/javascript">
var reqdate_cal, plant_off_date_cal, plant_off_date_cal, itemreqdate_cal; //calendar popups!
window.onload = function () {
reqdate_cal = new Epoch('epoch_popup','popup',document.getElementById('reqdate'));
plant_off_date_cal = new Epoch('epoch_popup','popup',document.getElementById('plant_off_date'));
plant_on_date_cal = new Epoch('epoch_popup','popup',document.getElementById('plant_on_date'));
itemreqdate_cal = new Epoch('epoch_popup','popup',document.getElementById('itemreqdate'));
}
</script>
basically this sets up so that if you click on say, 'itemreqdate' field a new object is created.
due to the fact that i am using ajax to create more fields that need this relationship i need a way to get new lines into the onload.
the code i have on the bottom of the returned ajax is:
<script>
var oldWindowOnload = window.onload;
window.onload = function(e) {
if(oldWindowOnload) oldWindowOnload(e);
<php loops thru all fields>
echo "var itemreqdate{$row['id']}_cal = new Epoch('epoch_popup','popup',document.getElementById('itemreqdate{$row['id']}'));";
<end of php looping>
}
<script>
the 'var oldWindowOnload = window.onload' section just stops the first set of onload events being overwritten by the new set.
any ideas? im stumped...