Very strange problem here, best to just see it yourself.
dsinsurancequotes.com when you type in your zip code and hit enter I have it mapped to the same function as if you clicked the GO button.
Now the problem is when you hit enter strange things happen and the URL gets all goofy and doesn't behave like it should. Which is find what drop down menu is selected and go to that perspective page.
If I type in zip code 60543 then an extra 5 the function is triggered and behaves exactly as it should.
But if I type in the zip code 60543 then hit ENTER it behaves totally different! And puts a bunch of garbage in the URL.
I'm so ultra stumped please help!
-
☆ A M B ☆
- 24,524 Posts
Your "return" is not really mapped to the same function. It's behaving as if its action were the same page (default) and the form values are being passed by GET (again default), so it's just behaving as a default form submission.
So how do I actually map it to the function, is there some special thing I'm missing?
sorry I'm like so confused at this point, I get what your saying but. so lost... =(
I'm kind of a noob with this kind of stuff
[ed. note: whaus777 last edited this post 14 years, 3 months ago.]
-
☆ A M B ☆
- 24,524 Posts
It's impossible for me to say without knowing what your code looks like. What you are trying to do is something for a developer; if you are new at this then it will be very difficult for you.
Thats the code for the form and we dont really need the javascript code since the only goal here is to actually get to that function instead of it just behaving strangely.
and then ive also tried to just a regular onKeydown call and handle the enter key inside the testResults function but like you said earlier its just never even going to that function, its defaulting to something stupid
I can handle it, I do hope I can call myself a developer lol. To me it just seems like modx is doing something specifically different with the enter command key than any other key, I just dont quite get it...
[ed. note: whaus777 last edited this post 14 years, 3 months ago.]
-
☆ A M B ☆
- 24,524 Posts
MODx has nothing to do with it. MODx doesn't care what kind of forms you use, or what javascript you use. All MODx does is insert your page content into its template.
You could use something like this jquery function
$('.input').keypress(function(e) {
if(e.which == 13) {
jQuery(this).blur();
jQuery('#submit').focus().click();
}
});
looks promising.. how do I implement that?
name my input box id input?
name my button to be clicked id submit?
guess I am dumb