Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Search button

Reply
Thread Tools

Search button

 
 
Shelly
Guest
Posts: n/a
 
      11-30-2007
I know this must be simple, but I need a little help as this isn't my area.
I have a search box called searchText and a search button called
searchButton. If a user puts "foo" in the text box and clicks the search
button, I want this to change pages with "foo" as a parameter. Sort of go
to "_the_new_page?param=foo" from the onclick command. How do I construct
that such that it forms that string and does a window.location with that
string? I looked over the web, but didn't find clear examples.



 
Reply With Quote
 
 
 
 
BootNic
Guest
Posts: n/a
 
      11-30-2007
"Shelly" <(E-Mail Removed)> wrote:
news:(E-Mail Removed):

> I know this must be simple, but I need a little help as this isn't my
> area. I have a search box called searchText and a search button called
> searchButton. If a user puts "foo" in the text box and clicks the
> search button, I want this to change pages with "foo" as a parameter.
> Sort of go to "_the_new_page?param=foo" from the onclick command. How
> do I construct that such that it forms that string and does a
> window.location with that string? I looked over the web, but didn't
> find clear examples.


<form action="/_the_new_page" action="get">
<div>
<label for="t1">search item </label>
<input type="text" id="t1" name="param">
</div>
<div>
<input type="submit" value="searchButton">
</div>
</form>

--
BootNic Friday November 30, 2007 12:32 AM
"So tell me, just how long have you had this feeling that no one is
watching you?"
*Christopher Locke: Entropy Gradient Reversals*
 
Reply With Quote
 
 
 
 
BootNic
Guest
Posts: n/a
 
      11-30-2007
BootNic <(E-Mail Removed)> wrote: news:Xns99F85784EC4CBootNic@
85.214.90.236:

> "Shelly" <(E-Mail Removed)> wrote:
> news:(E-Mail Removed):
>
>> I know this must be simple, but I need a little help as this isn't my
>> area. I have a search box called searchText and a search button called
>> searchButton. If a user puts "foo" in the text box and clicks the
>> search button, I want this to change pages with "foo" as a parameter.
>> Sort of go to "_the_new_page?param=foo" from the onclick command. How
>> do I construct that such that it forms that string and does a
>> window.location with that string? I looked over the web, but didn't
>> find clear examples.

>
> <form action="/_the_new_page" action="get">


That second action should have been method.

<form action="/_the_new_page" method="get">

[snip]

--
BootNic Friday November 30, 2007 1:13 AM
A person without a sense of humor is like a wagon without springs,
jolted by every pebble in the road.
*Henry Ward Beecher*

 
Reply With Quote
 
Shelly
Guest
Posts: n/a
 
      11-30-2007
BootNic wrote:
> BootNic <(E-Mail Removed)> wrote: news:Xns99F85784EC4CBootNic@
> 85.214.90.236:
>
>> "Shelly" <(E-Mail Removed)> wrote:
>> news:(E-Mail Removed):
>>
>>> I know this must be simple, but I need a little help as this isn't
>>> my area. I have a search box called searchText and a search button
>>> called searchButton. If a user puts "foo" in the text box and
>>> clicks the search button, I want this to change pages with "foo" as
>>> a parameter. Sort of go to "_the_new_page?param=foo" from the
>>> onclick command. How do I construct that such that it forms that
>>> string and does a window.location with that string? I looked over
>>> the web, but didn't find clear examples.

>>
>> <form action="/_the_new_page" action="get">

>
> That second action should have been method.
>
> <form action="/_the_new_page" method="get">
>
> [snip]


I need the resulting string that appears on the target page to be:

_the_target_page?type=blah&keyword=foo

I could make the name of the input text field be keyword. What would the
action look like? Would it be

"_the_target_page?type=blah" ?

Would I rather just need to define a hidden field and give it the name
"type" and the value "blah" ?

If this is the case, then I am left with the single problem of the not
having an input button of type submit, but having an image instead.

Shelly


 
Reply With Quote
 
Toby A Inkster
Guest
Posts: n/a
 
      11-30-2007
Shelly wrote:

> Would I rather just need to define a hidden field and give it the name
> "type" and the value "blah" ?


Yep. That's certainly the easiest way.

> If this is the case, then I am left with the single problem of the not
> having an input button of type submit, but having an image instead.


<input type=image src="foo.png" alt="Submit Your Foo Query">

If you give that input a name, then the browser should also add x,y co-
ordinates for the pixel that the user clicked on to the resultant URL.
Sometimes that's useful. Most of the time it's not.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 5 days, 19:25.]

Sharing Music with Apple iTunes
http://tobyinkster.co.uk/blog/2007/1...tunes-sharing/
 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      11-30-2007
Scripsit Toby A Inkster:

> Shelly wrote:

- -
>> If this is the case, then I am left with the single problem of the
>> not having an input button of type submit, but having an image
>> instead.


Huh? _What_ is the problem? If the problem is that you don't have a
normal submit button, get one. If not, make sure that you are
solving a problem and not creasting one.

> <input type=image src="foo.png" alt="Submit Your Foo Query">


Well, the alt text is too long. The button text should seldom be longer
than one or two words, like "Submit query". And you should also have the
name="Submit query" and value="Submit query", for user agents that use
_them_ and not the alt attribute as fallback.

> If you give that input a name, then the browser should also add x,y
> co- ordinates for the pixel that the user clicked on to the resultant
> URL. Sometimes that's useful. Most of the time it's not.


The coordinates are not included unless there is a name="..." attribute.

But image submit buttons are almost always a bad idea. They are mostly
used for esthetic reasons, but I don't think I've _ever_ seen such a
button that looks better than, say, the default rendering of submit
buttons on XP or Vista. I might say that _some_ of them were a slight
improvement over the "ugly gray buttons" in stone-age browsers that are
mostly used by freaks these days.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 
Reply With Quote
 
Shelly
Guest
Posts: n/a
 
      11-30-2007
Toby A Inkster wrote:
> Shelly wrote:
>
>> Would I rather just need to define a hidden field and give it the
>> name "type" and the value "blah" ?

>
> Yep. That's certainly the easiest way.
>
>> If this is the case, then I am left with the single problem of the
>> not having an input button of type submit, but having an image
>> instead.

>
> <input type=image src="foo.png" alt="Submit Your Foo Query">
>
> If you give that input a name, then the browser should also add x,y
> co- ordinates for the pixel that the user clicked on to the resultant
> URL. Sometimes that's useful. Most of the time it's not.


Thank you very much. That worked like a charm. The hidden fields were
necessary.

--
Shelly


 
Reply With Quote
 
Toby A Inkster
Guest
Posts: n/a
 
      11-30-2007
Jukka K. Korpela wrote:
> Scripsit Toby A Inkster:
>
>> If you give that input a name, then the browser should also add x,y co-
>> ordinates for the pixel that the user clicked on to the resultant URL.

>
> The coordinates are not included unless there is a name="..." attribute.


Isn't that what I said?

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 5 days, 23:40.]

Sharing Music with Apple iTunes
http://tobyinkster.co.uk/blog/2007/1...tunes-sharing/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Google search result like site search!! How? =?Utf-8?B?TGFrc2htaSBOYXJheWFuYW4uUg==?= ASP .Net 3 05-06-2005 02:08 AM
removing search engines from the search bar whatever.or.not@gmail.com Firefox 1 02-17-2005 12:06 PM
Search Bar not displaying search Engines Zimran Douglas Firefox 1 01-07-2005 02:30 PM
search within a search within a search - looking for better way...my script times out Abby Lee ASP General 5 08-02-2004 04:01 PM



Advertisments