Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Search - default value?Search - default value?
Previous
 
Next
New Post
3/23/2009 11:50 AM
 

I have a very simple search box and button but would like to have a default value such as "Enter Search" to make it a little clearer... and when they click it clears this (I have a js to do this 'onclick').

Unfortunately I don't know how to get this level of control over the DNN search feature.  Is there a way this can be easily achieved or am I expecting too much?

If not, is there a way to include the search function in a Portal skin but with greater control over it... but to work in just the same way (as a DNN control)?

 
New Post
3/24/2009 4:35 PM
 

David-
You can add what you described without altering any core code via Javascript.  The trick is to wait until the page has fully loaded, then set the deault value via DHTML and attach your "onclick" event to the search input box.
 
The search input box always has an id of "dnn_dnnSEARCH_txtSearchNew".
 
Here's a post on how to force your Javascript code to wait until a DNN page has fully loaded before executing:
 
  http://www.eguanasolutions.com/DNN_Blog/EntryID/4.aspx
 
And here's a post with an example of attaching an "onclick" event to an already-rendered HTML element (look for the "addeventlistener" section in the sample code):
 
  http://www.eguanasolutions.com/DNN_Blog/EntryID/25.aspx
 
 
You can test out your javascript code using a Text/HTML box.  If you get things working te way you like, transfer the code to you skin.

-mamlin


esmamlin atxgeek.me
 
New Post
3/25/2009 5:22 AM
 

Thanks Mamlin (again)

That's probably a bit more complex than I was looking for, partly as I am not too familiar with js... and also because I was hoping for a simple way to gain actual control of the DNN search function.

On this post I found:

suwandy wrote

You can do a custom search by just including a text box (server control) and a submit button(server control)
Then on the submit button onclick handler you just need to redirect to searchresult.aspx page
By default this page is installed automatically with module searchresult on it.

And this does sound like an easier method to implement though I'm not quite sure what is used in the skin .ascx file to do this.

 

 
New Post
3/26/2009 5:53 PM
 

The quote described adding an empty search box and submit button for DNN search.  This is what you already have with your skin's DNNSEARCH skin object, therefore there'd be a certain amount of coding to do (not much, but some) just to get to where you already are.
 
You described having the box auto-populated with a default value and clearing that value with an event handler for the ONCLICK event.  You'd actually want to clear it when the box gains focus by any means but that's a different topic.
  
If you feel more at ease with replacing the skin object with your own box and code and then adding javascript to that then you can certainly do so.  You'll need to use inline VB in your skin to dynamically determine your portal's Search Results page (so the skin will work in any portal) and then build and attach the results link for your "Search Submit" button.  To build the full search URL you'll need to append the search results page URL with: "?Search={your input box's search term}"
 

My personal preference would still be the JS insert and event attach I first mentioned since you could leverage it for use with any search implementation (see my post on using Google AJAX Search instead of DNN Search) or any type of input box at all whether it's a search box or some other box.  Either method will work, though, and neither should require more than half a dozen lines of code so they should be fairly equal to each other with respect to how much code you have to add.
  
Good luck-
-mamlin


esmamlin atxgeek.me
 
New Post
3/31/2009 4:14 AM
 

I actually got this working in an easier way, and thought it's worth posting for others.

Basically, I changed the DNN Search token in the skin by adding Visible="False" and adding the code was generating in it's place - so it does work.  This way I've removed the space DNN Search was forcing into it plus can add other scripts, default values etc much easier.

I've used OWS to add this, and applied it as the skin object (configuration here). This seems easy as I can just modify this or the CSS and it changes on all the skin files that the object is applied.

 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...Search - default value?Search - default value?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out