Focal Point
[SOLVED]Auto-Execute Procedure

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6327073306

May 06, 2011, 08:59 AM
dburton
[SOLVED]Auto-Execute Procedure
My code below is getting the date 30 days prior to the current date and then it assigns it to a variable that is later passed to a procedure by clicking on a button.

I would like to execute that procedure as soon as the person has logged into the dashboard with the value being passed to it.

Can someone help me with executing the procedure right away instead of having to click on the button?

function onInitialUpdate(){
	var today = new Date();
	today.setDate(today.getDate()-30);
	var t_date = today.getDate();
	if (t_date<10) {t_date='0'+t_date};
	var t_mnth = today.getMonth()+1;
	if (t_mnth<10) {t_mnth='0'+t_mnth};
	var t_year = today.getFullYear();
	t_year = t_year.toString().slice(2);
	var end_date = t_year+"/"+t_mnth+"/"+t_date;
	DateReceivedFrom.value = end_date;
}

function button1_onclick(ctrl) {
OnExecute(ctrl)
}

function button1_onclick(ctrl) {

 if (DateReceivedFrom.value == '' )
	{
		alert("From Date field is empty.  Please select a date.");
		return;
	}

OnExecute(ctrl)
}  


Thanks.

This message has been edited. Last edited by: dburton,


WebFOCUS 7.7.03
Windows Web Server 2008
MS SQL Server 2000
Excel,CSV,PDF,HTML
May 06, 2011, 09:20 AM
dhagen
Add a click method to the onInitialUpdate

document.getElementById('button1').click()


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
May 12, 2011, 04:06 PM
dburton
Thanks for the help. This worked for me.


WebFOCUS 7.7.03
Windows Web Server 2008
MS SQL Server 2000
Excel,CSV,PDF,HTML