Reputation: 146191
I have a blog and it is powered by WordPress. It had a non-responsive theme before and today I've installed a responsive theme. I've built this theme from some free html themes, collected some peaces from other themes, modified and convert it to WordPress theme within a week and it's HTML5, CSS3 with modernizr.js
.
Now, I have a strange problem and that is, in the header.php
I have a search input and it suppose to submit the form on enter (default behaviour), but whenever I press enter, it doesn't submit the form. I looked in almost in every JavaScript
files to find if there is any keydown
or suchlike event that might preventing the submission but didn't find anything and I'm aware of all files as well. This is the site and still now under development process, so can anyone please kindly look at this site and let me know if I've missed anything and this is the markup
<form method="get" id="searchbar" action="<?php bloginfo('url'); ?>/search.php" style="margin:0 0 -10px !important;" _lpchecked="1">
<input id="search-submit" type="submit" name="submit" />
<input id="search-bkg" type="text" name="s" placeholder="Type and press enter.." />
</form>
The problem is that, form is not submitting on enter. Maybe I'm missing something so need help of fellows or any advise/tips to find out the problem. Thanks!
Update : This is the current code (after some suggestions from fellows here)
<form action="<?php echo home_url() ?>/search.php" method="get">
<input id="search-submit" type="submit" name="submit" />
<input id="search-bkg" type="text" name="s" placeholder="Type and press enter.." />
</form>
And this is the rendered markup in the browser
<form action="http://heera.it/search.php" method="get" _lpchecked="1">
<input id="search-submit" type="submit" name="submit">
<input id="search-bkg" type="text" name="s" placeholder="Type and press enter.." style="margin-top: 2px; display: none; width: 0px;">
</form>
But, no changes happened, remaining same problem.
Upvotes: 2
Views: 4909
Reputation: 146191
For future reference (if someone else faces the same problem, it's a debugging tip)
It was actually a plugin, which was taking the lead of the form submission using a keydown
event handler and it was hard to find the code (4/5 lines) from a big file and also it was hard to find out exactly which file is doing the job. But suddenly I realized that if I disable JavaScript
and try to submit the form using enter
then I could be sure that there is definitely js
event handler, which is preventing the submission. So, i did it and it worked. Finally, I removed some plugins and added one after one and found out the script
that was preventing submission of the form. So, once I got it, I just change the code and it worked.
Upvotes: 6
Reputation: 1284
Something's up with the way the PHP
is rendering the bloginfo url. Your form's action is set to #
which I'm pretty sure you don't want if you're doing a standard get request.
Upvotes: 1