Using the Enter Key on a text Area for a new line

This is the knowledgebase for Genie, all resolved support and product questions are located here. Please search this forum before posting any new support and technical questions.
Locked
Profound Logic
Site Admin
Posts: 252
Joined: Fri Dec 14, 2007 1:09 pm
Contact:

Using the Enter Key on a text Area for a new line

Post by Profound Logic »

Question:

The Enter key is used to update and move to the next screen, however I need to be able to enter a new line on a text area. The Enter key needs to operate differently on a text area. Is this possible?

Response:

From my understanding of the problem, you need a function that handle key events and limits the enter key on a text area when it’s filled out.

You may need this JavaScript function in your custom.js file. Your custom.js file should be included within the skin’s folder you are currently working with. Assuming you are working with the Gradient Skin, the custom.js file should be under this path: /YourGenieDirectory/web/Skins/Gradient/custom.js

Add this function to the custom.js

Code: Select all

function handleKeyEvent(event) 

{
    if (!event) 
        event = window.event;
    if (event.keyCode == 13)         // Enter
    {  
       if (window.event) 
       {
            window.event.cancelBubble = true;
       }

       if (event.preventDefault) 
       {
            event.cancelBubble = true;
       }
   }

In the designer window, click on the textarea and find the “onkeydown” event in the properties window.

Add “handleKeyEvent()” in the “onkeydown” event to call the JavaScript function whenever the user presses any key detecting the enter key

Save your screen and reload the page


This should accomplish what you need
Locked

Who is online

Users browsing this forum: No registered users and 1 guest