Multiple Form Elements + ENTER key

Posted by Community Admin on 04-Aug-2018 17:19

Multiple Form Elements + ENTER key

All Replies

Posted by Community Admin on 05-Jan-2012 00:00

Hi -

We're running into some user issues where they are wanting to hit the ENTER key after inputting text into one of three different form fields on a page. We have the following:

- Newsletter Signup box (Constant Contact)
- Sitefinity search box
- Store Locator zip code / address form

I'm trying to think of a way to allow the user to use their ENTER key but have the focus be on whatever form element they are trying to fill out. I tried creating an iframe for the newsletter signup box, however now the SF search box is triggered when using the ENTER key on the zip code lookup box. Any help or ideas would be greatly appreciated!

Thanks,
Greg

Posted by Community Admin on 06-Jan-2012 00:00

Hi,

 I tried achieving this only with jquery but it turned out to be impossible. This is because each widget renders different HTML and even if we select the current focused element (which I was able to do), there is no way to define which is the relevant button for this widget (the only way would be to hardcode selection of some wrapper divs by class and find the button from their child elements, but this wouldn't work well).
So, I came to the conclusion that the only way would be to map template for each of the relevant widgets and in the server code add the jquery selection code, together with the Client ID of the widget. The code should be similar to this:

TextBox1.Attributes.Add("onkeydown", "if(event.which || event.keyCode)if ((event.which == 13) || (event.keyCode == 13)) document.getElementById('"+Button1.UniqueID+"').click();return false; else return true; ");

All the best,
Svetoslav Petsov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 19-Jan-2012 00:00

Hi Svetoslav -

Can you expland on what you meant by "map template for each of the relevant widgets"? I know some of the widgets have an advanced settings area where you can map external templates, but how could this be done with the Sitefinity search box?

Thanks,
Greg

Posted by Community Admin on 21-Jan-2012 00:00

Hello,

 All of the widgets' templates can be mapped by doing the following:
Go to Administration >> Settings >> Advanced >> Controls >> ViewMap and create a new map, for example for the Search box:
HostType: Telerik.Sitefinity.Services.Search.Web.UI.Public.SearchBox
LayoutTemplatePath: ~/Controls/MyTemplate.ascx (the virtual path to your .ascx template in the solution)

Greetings,
Svetoslav Petsov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed