summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/base/prado.js
blob: 2174908fc60dcf24f2ef323123592701e91f9033 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Prado = Class.create();

Prado.version = '3.0a';

Prado.Button = Class.create();

Prado.Button.buttonFired = false;
Prado.Button.fireButton = function(event, target)
{
	if (!Prado.Button.buttonFired && event.keyCode == 13 && !(event.srcElement && (event.srcElement.tagName.toLowerCase() == "textarea")))
	{
		var defaultButton = document.getElementById ? document.getElementById(target) : document.all[target];
		if (defaultButton && typeof(defaultButton.click) != "undefined")
		{
			Prado.Button.buttonFired = true;
			defaultButton.click();
			event.cancelBubble = true;
			if (event.stopPropagation)
				event.stopPropagation();
			return false;
		}
	}
	return true;
}

Prado.TextBox = Class.create();

Prado.TextBox.handleReturnKey = function(event)
{
	if (event.keyCode == 13)
	{
		var target;
		if(typeof(event.target)!="undefined")
			target=event.target;
		else if(typeof(event.srcElement)!="undefined")
			target=event.srcElement;
		if((typeof(target)!="undefined") && (target!=null))
		{
			if(typeof(target.onchange)!="undefined")
			{
				target.onchange();
				event.cancelBubble=true;
				if(event.stopPropagation)
					event.stopPropagation();
				return false;
			}
		}
	}
	return true;
}