Search button

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.
Shelly [ Fr, 30 November 2007 05:38 ] [ ID #1883251 ]

Re: Search button

"Shelly" <sheldonlg.news [at] asap-consult.com> wrote:
news:13kv5o63hg13o18 [at] corp.supernews.com:

> 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*
BootNic [ Fr, 30 November 2007 06:32 ] [ ID #1883255 ]

Re: Search button

BootNic <b00tnic [at] yahoo.com> wrote: news:Xns99F85784EC4CBootNic [at]
85.214.90.236:

> "Shelly" <sheldonlg.news [at] asap-consult.com> wrote:
> news:13kv5o63hg13o18 [at] corp.supernews.com:
>
>> 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*
BootNic [ Fr, 30 November 2007 07:13 ] [ ID #1883258 ]

Re: Search button

BootNic wrote:
> BootNic <b00tnic [at] yahoo.com> wrote: news:Xns99F85784EC4CBootNic [at]
> 85.214.90.236:
>
>> "Shelly" <sheldonlg.news [at] asap-consult.com> wrote:
>> news:13kv5o63hg13o18 [at] corp.supernews.com:
>>
>>> 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
Shelly [ Fr, 30 November 2007 12:38 ] [ ID #1883282 ]

Re: Search button

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/11/28/itunes-sharing/
Toby A Inkster [ Fr, 30 November 2007 13:38 ] [ ID #1883286 ]

Re: Search button

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
Shelly [ Fr, 30 November 2007 15:36 ] [ ID #1883292 ]

Re: Search button

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/
jkorpela [ Fr, 30 November 2007 15:35 ] [ ID #1883294 ]

Re: Search button

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/11/28/itunes-sharing/
Toby A Inkster [ Fr, 30 November 2007 17:50 ] [ ID #1883301 ]
Miscellaneous » alt.html » Search button

Vorheriges Thema: windows - bad image error on Vista
Nächstes Thema: GET Message