I want to make a simple searchbox in my website. I think for my situation, the best way is to use something like w3schools.com did. When user types smth and press enter it redirects to google.com/search and it will search from only w3schools.com in google because there is site:www.w3schools.com is given in url. how can i do that?
A simple solution would be something like this:
<html>
<head></head>
<body>
<form method="get" name="searchform" action="http://www.google.com/search" target="_blank">
<input type="hidden" name="sitesearch" value="stackoverflow.com">
<input type="text" name="as_q" size="20" value="Search stackoverflow.com">
<input type="submit" value="Search" title="Search">
</form>
</body>
</html>
But you should also check this out:
http://www.google.com/cse/
Just browse source code and take everything you need, that trick will often do in case of HTML how-to's:
<form method="get" name="searchform" action="http://www.google.com/search" target="_blank">
<input type="hidden" name="sitesearch" value="www.yoursite.com">
<input type="text" name="as_q" size="20" value="Search yoursite.com">
<input type="submit" value="Search" title="Search">
</form>
Well. Actually it seems this is quite easy job. I have found the solution At:
http://www.askdavetaylor.com/how_can_i_add_a_google_search_box_to_my_web_site.html/
I think what you are looking for is Google Custom Search Engine. Start here: http://www.google.com/cse/docs/ , http://www.google.com/cse/manage/all
Related
I'm new to ASP very recently and I can't seem to get this to work
<html>
<body>
<form action="test.asp" method="post">
<input type="text" name="text" />
<input type="submit" value="submit" />
</form>
<%
dim x
x=Request.Form("text")
Responce.Write(x)
%>
</body>
</html>
The text box and submit button are displayed however this error is displayed and this ASP does not work.I'm not sure if something is wrong with my code or IIS. Any help on this would be much appreciated
An error occurred on the server when processing the URL. Please contact the system administrator.
If you are the system administrator please click here to find out more about this error.
Could be you have a typo:
Responce.Write(x)
should be:
Response.Write(x)
If you just need to print your "text" variable:
<html>
<body>
<form action="test.asp" method="post">
<input type="text" name="text" />
<input type="submit" value="submit" />
</form>
<%=Request.Form("text")%>
</body>
</html>
I have tried iframing but it doesn't worked in Javascript disabled browser. Anyone please tell me how can I mask an url and still worked in Javascript disabled situation, thanks in advance.
Use POST, rather than GET. Something like this early in the page:
<form action="nextpage" method="post">
<input type="hidden" name="parameter1" value="value1" />
...etc...
This page
</form>
<form action="otherpage" method="post">
<input type="hidden" name="parameter1" value="value1" />
...etc...
That page
</form>
Bit more longwinded, but it will work.
Hello I am learning Bootstrap and would like to have a wysiwyg editor.
I found bootstrap-wysiwyg and want to use it.
http://mindmup.github.io/bootstrap-wysiwyg/
this example in website official use
<div id="editor">
</div>
not use
<input type="text" name="editor"> or <textarea name="editor"> </textarea>
However, I cannot figure out how to get formatted text on the server-side when a form is submitted.
Simple Solution is Submit Form by js method.
<div class="field" id="editor" data-placeholder="Insert your description."></div>
<input type="hidden" name="description" id="editor_description" value="" />
<script>
function submitform(){
$('#editor_description').val($('#editor').html());
$("#form").submit();
}
</script>
I would like to change the the "return" button text on the Mobile Safari keyboard when my input element is focused. I know you can do this:
<form action="somewebsite.com">
<input id='SearchTextBox' type="search"/>
<input id='SearchButton' type="button" value="Search" />
</form>
But I don't want the form tag because the search is ajaxian (I don't want to reload the page).
Does anyone know if this is possible?
Heh, should have thought of this (coworker solved). Just cancel the form submission with JavaScript. For example:
<form action="#" onsubmit="return false;">
<input id='SearchTextBox' type="search"/>
<input id='SearchButton' type="button" value="Search" />
</form>
You can now use enterkeyhint
<input enterkeyhint="search" />
Theres more options like "send", "go", etc
I want to create a custom search box and use that to interact with Drupal's search module. Currently everything works pretty well. However, i would also need to use a proper token with the search. I have no idea what key Drupal uses to form this token.
Currently i have:
<form class="search-form" action="/search/node" method="post" id="search-form" accept-charset="UTF-8">
<input type="text" name="keys" class="search_box" value="Search ..." />
<input type="hidden" name="form_id" id="search-form" value="search_theme_form" />
<input type="hidden" name="form_token" value="<?php print drupal_get_token('search_theme_form'); ?>" />
</form>
This works well enough to display the results of one page. If i try to navigate to the second results page, all the results are thrown away.
You should probably use the more proper
$form = drupal_get_form('search_block_form');
return drupal_render($form);
http://api.drupal.org/api/drupal/modules--search--search.module/function/search_form/7
It turned out to be as simple as changing the form from post to get. Here's the html for a working solution.
<form class="search-form" action="/search/node" method="post" id="search-form" accept-charset="UTF-8">
<input type="text" name="keys" class="search_box" value="Search ..." />
</form>
You don't need to define tokens or anything of the sort.
And in theme use:
<?php
$form = drupal_get_form('search_block_form');
echo render($form);
?>