All pastes #659457 Raw Edit

Untitled

public text v1 · immutable
#659457 ·published 2007-08-16 08:58 UTC
rendered paste body

// HEY. i got this script that captures in textfield/textarea the key press and once the user press enter its submit the data  and once he press esc its cancel it. the problem is that if the user presses enter in TEXTAREA its sends its instad of make a new line,,how can i slove it that if its textarea then dont use EIP_Cancel_Send_Data() function?



	function EIP_CaptureKeyCode(e,elementId) {

		var myKeyCode=0;

		// Internet Explorer 4+
		if ( document.all ) {
			myKeyCode=e.keyCode;

			// Netscape 4
		} else if ( document.layers ) {
			myKeyCode=e.which;

			// Netscape 6
		} else if ( document.getElementById )
		{
			myKeyCode=e.which;

		}

		if (myKeyCode == 27)
		{
			//case esc
			EIP_Cancel_Send_Data(elementId,27);

			return false;
		}
		if (myKeyCode == 13)
		{
			//enter key

			EIP_Send_Data(elementId,$('#<?=$this->GroupName?>'+elementId+'Text').val());
			return false;

		}
		return true;




	}