Skip to main content
Inspiring
June 4, 2010
Question

<cfinput> search box and submit button

  • June 4, 2010
  • 2 replies
  • 828 views

So I'm doing a search box with a submit button

I'd like it to be intuitive by having the words "search..." inside it by default

how do I make "search..." disappear when the user clicks on the box ?

is there any preference to post or get ?

This topic has been closed for replies.

2 replies

Participant
June 4, 2010

You can use Javascript to do that. I searched Google for "html search box default text" and found quite a few examples.

Inspiring
June 4, 2010

Your question is not clear.

However, the post vs get question is clear.  I prefer to post my forms because I don't want form variables in the address bar.  This is especially true when the form contains a textarea and the data has carraige returns.

Inspiring
June 4, 2010

If it's a search box though, making it a get probably makes sense: it doesn't change the system so it's not really a POST sort of operation, plus the punter can bookmark the search (results) URL which is quite handy.

Google uses a GET, for example.

But there's no hard-and-fast rule, obviously
.

As for the original question: this is really a client-side question, not a CF question (despite using <cfinput>).  As someone else suggested, read up on HTML and probably the JavaScript event model.


--

Adam