Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

<cfinput> search box and submit button

Participant ,
Jun 04, 2010 Jun 04, 2010

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 ?

TOPICS
Getting started
806
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 04, 2010 Jun 04, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 04, 2010 Jun 04, 2010
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 04, 2010 Jun 04, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources