Announcement

#1 2013-11-24 21:32:11

Hoheria
Member
2013-11-16
4

How can I use an image to launch pre-defined search

Hello all,

I am using the additional pages plugin as a launch page on my site. What I'd like to do is have a series of images which can be clicked to launch a predefined search of my images. Now its fairly easy to get a search form on the additional page like this:

<div class="myHomePage_links">

<form action="qsearch.php" method="get" id="quicksearch">
  <p><input type="text" name="q" id="q"style="background-color: #848484; color: #ffff66;width:180px;height:30px;border:2px;groove #F00;"value="search" onfocus="value='';"></p>
</form><br>Enter search <br>words then &#x21a9;</div>

but I cannot get it to work using an image - or at least I can get what seems to be an empty search because clicking the image launches the 'search result' page. I cannot figure out where to put the predefined search value - lets call it "cats"

<form action="qsearch.php" method="get" id="quicksearch">
<a href="#" onclick="document.forms[0].submit();return false;"><img src="http://www.my+++site/mhj/pics/9.jpg" /></a>
</form>

Where can I put the search string "cats" for this to work - I have tried everywhere!!

your help will be hugely appreciated

and best wishes all for a cracking piece of software

Offline

 

#2 2013-11-25 10:55:54

flop25
Piwigo Team
2006-07-06
7037

Re: How can I use an image to launch pre-defined search

Hello
juste put an input type hidden with the same id/name name="q" id="q" and withe your value, and the image as a submit button for the form


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#3 2013-11-25 13:31:28

Hoheria
Member
2013-11-16
4

Re: How can I use an image to launch pre-defined search

thanks flop25, thats a great help. Finally got it to work like this:

<form action="qsearch.php" method="get" id="quicksearch">

<button type="submit" name="q" id="q" value="cats" style="height:257px; width:257px" onclick="document.forms[0].submit()";return false;"><img src="http://www.yourwebsitepath/pics/6.jpg" /></a>
</form>

the 257px is my image size, still a little bit of table formatting to sort out but nearly there.

many thanks and I hope this is useful to someone else

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2022 · Contact