The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> One Form, Two Buttons = Two Diffrent Actions?, This must be possible, can someone help, thanks in advance!
lambokid
post May 9 2007, 02:59 PM
Post #1





Group: Members
Posts: 2
Joined: 9-May 07
Member No.: 2,773



Thanks for your time

I want one text box, with two buttons too perform two different actions.
When i press one button i want it to search the site, and the other button to search google

Here is a visual of what i want.
IPB Image

This is what i have now.....

CODE
    <form action="search.php" method="post">
      <input class="search" onblur="if (value==''){value='Search DDLoogle';}"  onfocus="if (value == 'Search DDLoogle') {value='';}" size="60" type="text"
          name="q" />
      <br><input class="button" type="submit" value=     "DDLoogle Search"      name="submit" size="12" />
    </form>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post May 9 2007, 05:25 PM
Post #2


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



Please see the FAQ entry Can I have two or more Submit buttons in the same form?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
lambokid
post May 9 2007, 07:53 PM
Post #3





Group: Members
Posts: 2
Joined: 9-May 07
Member No.: 2,773



okay i tried naming each button,
i searched google for a while, and 90% of the results says exactly that

but i dont understand what the naming accomplishes.
how is the names suppose to choose which action i want the form to perform?

well i pulled something out of my ___ , this obviously does not work...fully.
it automatically performs the first form action, whichever button i click


CODE
    

<form action="search.php" method="post" name="ddloogle">
<form action="http://www.google.com/custom" method="post" name="google">
      

<input class="search" size="60" type="text" name="q" />

<input type="submit" value="DDLoogle Search" name="ddloogle" />
<input type="submit"  value="Google Search" name="google" />

</form>

Example: (www.ddloogle.com/index2.php)



im juts guessing this is impossible, because i also find on google, that a form with two actions is impossible..blahblahblah
does anyone know anyway of helping me... i dont mind using another programming language, just name it..
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post May 10 2007, 12:02 PM
Post #4


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



You need a single server-side program that processes the form data and decides what to do based on which submit button was used.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 27th April 2024 - 01:25 AM