Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Untitled
Thursday, August 16th, 2007 at 2:58:53am MDT 

  1. // 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?
  2.  
  3.  
  4.  
  5.         function EIP_CaptureKeyCode(e,elementId) {
  6.  
  7.                 var myKeyCode=0;
  8.  
  9.                 // Internet Explorer 4+
  10.                 if ( document.all ) {
  11.                         myKeyCode=e.keyCode;
  12.  
  13.                         // Netscape 4
  14.                 } else if ( document.layers ) {
  15.                         myKeyCode=e.which;
  16.  
  17.                         // Netscape 6
  18.                 } else if ( document.getElementById )
  19.                 {
  20.                         myKeyCode=e.which;
  21.  
  22.                 }
  23.  
  24.                 if (myKeyCode == 27)
  25.                 {
  26.                         //case esc
  27.                         EIP_Cancel_Send_Data(elementId,27);
  28.  
  29.                         return false;
  30.                 }
  31.                 if (myKeyCode == 13)
  32.                 {
  33.                         //enter key
  34.  
  35.                         EIP_Send_Data(elementId,$('#<?=$this->GroupName?>'+elementId+'Text').val());
  36.                         return false;
  37.  
  38.                 }
  39.                 return true;
  40.  
  41.  
  42.  
  43.  
  44.         }

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

worth-right worth-right