Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4572156
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:36:23+00:00 2026-05-21T19:36:23+00:00

I would like to customize my search form. I am using Google Search Service

  • 0

I would like to customize my search form. I am using Google Search Service and have it linked to my domain and so on.

I chose the two column layout in the Control Panel, but however, I want to do something onSubmit of the form.

So I tried to put an actionlistener in jQuery into the form, however does not work.

Then I thought google certainly provides something for that. And yes they do. It is called:

setOnSubmitCallback()

http://code.google.com/apis/websearch/docs/reference.html

Unfortunately I dont get it.

So far I have:

google.load('search', '1', {language : 'en', style : google.loader.themes.MINIMALIST});

                    function initialize()
                    {
                        var searchControl = new google.search.CustomSearchControl('017998360718714977594:j6sbtr-d6x8');
                        searchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);

                        var options = new google.search.DrawOptions();
                        options.setSearchFormRoot('cse-search-form');

                        searchControl.draw('cse', options);
                    }

                    google.setOnLoadCallback(initialize);

So i have two divs:
#cse-search-form for the form and #cse for the results

#cse is in another div #searchResults, that is hidden and here it comes:

I want to open #searchResults in a dialog from jQuery UI.

$("#searchResults").dialog( { minWidth: 750, minHeight: 750 } );

Which will result into:

.setOnSubmitCallback(function() {
    $("#searchResults").dialog( { minWidth: 750, minHeight: 750 } );
} );

So my problem now is, where and on what do I have to put the setOnSubmitCallback?

I cannot put it on google.search.Search or CustomSearchControl as it is stated in the documentation. ANd I cannot call it in the onLoadCallback so it is very strange for me. Cannt figure out how to do that.

I hope somebody has some more experience for the google search and could help me out with a solution.

Thank you very much in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T19:36:24+00:00Added an answer on May 21, 2026 at 7:36 pm

    NOTE: the code below is using something Google deprecated. Use this instead: http://code.google.com/apis/customsearch/v1/overview.html

    <!DOCTYPE HTML>
    <html>
      <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <title>Hello World - Google  Web Search API Sample</title>
        <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/ui-lightness/jquery-ui.css" type="text/css" media="all" />
        <script src="https://www.google.com/jsapi" type="text/javascript"></script>
        <script language="Javascript" type="text/javascript">
        //<![CDATA[
        google.load('search', '1');
        google.load("jquery", "1.5.2");
        google.load("jqueryui", "1.8.12");
    
        function OnLoad() {
    
            var searchComplete = function(searchControl, searcher){
                $('#searchResults').dialog({modal: true, width: 700, height: 400, position: [50, 50]});
                for (result in searcher.results) {
                    var content = searcher.results[result].content;
                    var title = searcher.results[result].title;
                    var url = searcher.results[result].url;
                    $('#searchResults ul')
                        .append($('<li></li>')
                            .append($('<a/>').attr('href', url).text(title))
                            .append($('<p/>').text(content)));
                }
            };
    
            // called on form submit
            newSearch = function(form) {
              if (form.input.value) {
                // Create a search control
                var searchControl = new google.search.SearchControl();
    
                // Add in a set of searchers
                searchControl.addSearcher(new google.search.WebSearch());
                searchControl.addSearcher(new google.search.VideoSearch());
    
                // tell the searchControl to draw itself (without this, the searchComplete won't get called - I'm not sure why)
                searchControl.draw();
    
                searchControl.setLinkTarget(google.search.Search.LINK_TARGET_SELF);           
                searchControl.setSearchCompleteCallback(this, searchComplete);
                searchControl.execute(form.input.value);
              }
              return false;
            }
    
            // create a search form without a clear button
            // bind form submission to my custom code
            var container = document.getElementById("searchFormContainer");
            this.searchForm = new google.search.SearchForm(false, container);
            this.searchForm.setOnSubmitCallback(this, newSearch);
        }
        google.setOnLoadCallback(OnLoad);
    
        //]]>
        </script>
      </head>
      <body>
        <div id="searchFormContainer">Loading</div>
        <div id="searchResults" title="Search Results">
            <ul></ul>
        </div>
      </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an iPhone application using UINavigationController and would like to customize the elements
I'm using the sfGuardDoctrine plugin, and I would like to customize the form validation
I have a 1920x1200 screen an would like to customize VS2008 code windows to
I have a section where I would like to customize the left area of
I have created a search engine for my website using Google Webmaster Tools. Now
I have a default tableview style with 4 entries and would like to customize
I would like to customize the background (and maybe the border too) of all
I would like to customize an off-the-shelf software that has a Lite Edition and
I would like to write a shell extensions to completely customize the display of
Would like to get a list of advantages and disadvantages of using Stored Procedures.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.