By crabcakes on
Hi -
I'm trying to get this (http://drupal.org/node/141788) example to work inside of the Header portion of a view
<form action="/search/node" method="post" id="search-form" class="search-form">
<div class="form-item">
<input type="text" class="input-text" value="" size="25" name="keys" />
<input type="submit" value="Search" name="op" title="Search" alt="Search" />
<input type="hidden" value="<?php print drupal_get_token('search_form'); ?>" name="form_token" />
<input type="hidden" value="search_form" id="edit-search-form" name="form_id" />
<input type="hidden" name="type[your_content_type]" id="edit-type-your_content_type" value="your_content_type" />
</div>
</form>
The form shows up fine but throws a validation error? -- Validation error, please try again. If this error persists, please contact the site administrator. Obviously I've changed the content_type to various content types and I still get the same error.
Any help? Not even sure how to get D6 to show me where it is not validating.
TIA
Comments
anyone?
anyone?
fix
You need to have php filter module turned on and select the php code format on the page/block. It doesn't validate if you're using a full html view as it's not considered a valid form.
Heres how to get it working the easiest:
Make a page node.
Insert your code in the body.
Set the input type to "php code".
Use views to make a block view using that node.
If you really want to get ridiculous about it you can also hide the advanced search field set like so:
This doesn't actually "remove" the code, but no one will see it, so this might work for you.
search box for only one content type - results page?
Ok, this is by far the simplest solution (and only one I managed to get to work). Thanks for sharing :)
Is there a way to specify the search results page? Or to at least separate it from a main site search results page? My cck's are buried under a specific site path, and I'd like to keep the visitor there rather than at /search/node/ccktype ..hmm.. would pathalias work here as a terrible hack?
--
http://drupaltees.com
80s themed Drupal T-Shirts
Wow, I have looked all over
Wow, I have looked all over for this post. Seriously, I have - (counting, counting) - 25 tabs open that pertain to searching and adding extra search boxes. As a favor to other newbie, forum rats such as myself, I've expanded the great instructions from Todd:
1) Enable PHP Filter. This is found at /admin/build/modules under the Core - optional modules
2) Make a page node.
- Insert the code from the original post into the body.
- - Note: my test site is located at localhost/drupal so I had to change the action variable to action="drupal/search/node"
- - Note: don't forget to change the "your_content_type" part
- Set the input type to "php code".
3) Make note of the node number
4) Use views to make a block view using that node.
- Create a new Node View
- Add a Field. Specifically, Node:Body
- Add a Filter. Specifically, Node:NID is equal to Node ID number-from-step 3)
- Add a Block display.
5) Go to admin/build/block and configure the new block.
- I only wanted this block to show up when the appropriate content type was being viewed. I did this by adjusting the snippet titled "Show block only for specific content type:" found here: http://drupal.org/node/64135
Last aside, it looks like new functionality within views (http://drupal.org/node/118672) will allow for the use of "Or" statements in the filter. This will allow you to add a search bar to the top of a view that is showing a list of a given content type. So cool...