1

I am creating a Drupal site for a government agency, and we use Google Search for our websites. The problem I'm running into is the domain the site I'm creating is on is foo.com, and the search is supposed to be run through bar.gov.

My question is is there any way to get either the built in Seach module or the Google CSE module to submit the search query on the other domain? And if there isn't how would I go about creating either a block or content pane with the search box I need?

What I need is when you click Search on foo.com it directs you to bar.gov/gsearch?sitesearch=foo.com&q=terms. Specifically getting a form's action to be the bar.gov/gsearch.

3
  • @FreeRadical I know how to do that part, my issue is getting it so when you click Search on foo.com it takes you to bar.gov/gsearch?sitesearch=foo.com&q=terms
    – diego
    Commented Mar 30, 2015 at 19:15
  • In that case, your need just to use a HTML iframe to embed search on the other site. That's HTML - not Drupal. Commented Mar 31, 2015 at 1:50
  • @FreeRadical I don't have any way to make changes to the other site. I made an edit so hopefully what I need is more clear now.
    – diego
    Commented Mar 31, 2015 at 11:59

1 Answer 1

2

It's simple ,, if you know the HTML part so make your form action to the search site and call your GET parameters into the form!

something like this:

        <form  action="bar.gov/gsearch" target="_blank" method="GET" id="search-block-form">
        <input type="hidden" value="q" name="terms">
        <input type="hidden" value="foo.com" name="search">
<button type="submit" value="Search">Search</button>
    </form>

edit: you need to make sure you have HTML tags enabled and not stripped in anyway so the form and any other HTML tags be available .

7
  • I've tried doing that, but anytime I try putting a form in a block or content pane it just removes it.
    – diego
    Commented Mar 31, 2015 at 12:10
  • thats weird ,, for me I had the same request in our gov sites to replace the search form with Google so I built a module which has a tpl file with the form in it .. and it works just fine? what gets removed there in your case? Commented Mar 31, 2015 at 12:31
  • It replaces everything with between <form> and </form> with <p><br /> &nbsp;&nbsp;&nbsp;</p> Though from your comment it sounds like I will need to create a custom module with a template for it, is that correct?
    – diego
    Commented Mar 31, 2015 at 12:53
  • I get your problem now .. its the tags got stripped somehow .. you use CKeditor? did you use Full HTML format in your block? Commented Mar 31, 2015 at 13:36
  • I am using CKEditor and Full HTML
    – diego
    Commented Mar 31, 2015 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.