You are viewing limited content. For full access, please sign in.

Question

Question

Pressing Enter in a Custom Search form in Weblink pops up the Date Picker instead of submitting the form.

asked on August 26, 2015

If a custom search form in WebLink has a DatePicker option, whenever the user presses enter, the date picker pops up.

 

Ideally, we'd like this to submit the form and allow the null value to go through just as if the user clicked on the Submit button.

1 0

Answer

APPROVED ANSWER
replied on September 18, 2015

Appreciate the idea Wes!

 

I expanded on it to add the desired behavior. Now when users press enter, they will submit the search instead of pop-up the date picker.

 

<script type="text/javascript">
    $('#form1').keypress(function(e){
        if (e.keyCode == 10 || e.keyCode == 13) 
           {
	     e.preventDefault();
	    $('input[type="submit"]').click();
	 }
    });
</script>

 

5 0

Replies

replied on September 18, 2015

In the meantime you can override the "Enter" key issue by opening up "CustomSearch.aspx" and adding the following code right above the "</body>" tag:

    <script type="text/javascript">
        $('#form1').keypress(function(e){
            if (e.keyCode == 10 || e.keyCode == 13) 
                e.preventDefault();
        });
    </script>

Save the file and then reload the page.

3 0
replied on August 28, 2015

We have a client frustrated by this as well...

0 0
replied on September 1, 2015

Thanks for reporting this. We have this issue noted in our system and will update the thread when a resolution is available.

0 0
replied on July 21, 2016

Thanks for script Wes & Carl. I was able to make use of this for my customer. +1 to the list of people who would like to have this as a built-in feature.

0 0
replied on November 9, 2017 Show version history

Hi there,

I have several search forms and I want to know whether I should replace 'form1' from your code to my search form name. 

Also, when I pressed 'Enter', the field input are being cleared.

Thanks to advise.

0 0
replied on November 9, 2017

Will WebLink 10 be updated to make the submit button the default and not the date picker button?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.