I have read many QA regarding posting data to website search field and press submit button.
I followed below solutions but still no luck.
Example1Example2Example3
I want to POST data to for example this website which search box and button code as follows,
<div id="search">
<input type="search" class="text" value="Enter model or part number" id="searchterm_head">
<button class="blue-header-search" type="submit" id="searchbutton_head">Search</button>
<a onclick="if ($('.nav-menu').is(':visible'))
{$('.nav-menu').slideUp(200).fadeOut(200)}
else {$('.nav-menu').slideDown(200).fadeIn(200);};"
class="nav-menu-icon">
<img alt="" src="/assets/images/nav-menu-icon.png">
</a>
</div>
But this code is not included in any form and values are submitted by javascript/jquery.
So is this possible to pass value this kind or search box using cURL
I want to fetch product page url and its content.
Any guidance would be appreciated.
Thanks a lot
Update
I think I found form tag, but there is no value in action attribute.
<form id="MasterForm" action="" method="post">
Related
I want a javascript code that will take an input as Post ID and add the id to this default url (https:bemaearn.xyz/?p=) so that the submit button will load the post on WordPress. A user can access any post using the post ID
I do not think you need javascript.
<form action="/">
<input type="text" id="posts" name="p"><br>
<input type="submit" value="Submit">
</form>
I have a basic search box I created to search a database. When a user submits their search terms, I would like to have it automatically attach additional terms to the search. The field "name" for the terms the user enters is "term". I have been able to add a hidden field that includes the additional search variables I want automatically attached when the user submits the form. The problem is the name for that field also has to be "term" for the search to work properly. When the search is submitted, the second "term" in the query string causes the search to not execute properly. Is there a way to pass additional "term" variables using a hidden field without passing the field name "term"? I've included an example below. Any help is greatly appreciated - thanks in advance!
term=%28dog+OR+cat%29+AND+%28young+OR+old%29**&term**=AND+veterinarian
My form structure currently looks something like the following:
<form action="form link" class="class-name" id="search-form" method="get" target="_blank">
<div class="wrapper"><textarea class="query-box" id="query-box" name="term" value="" placeholder="text"></textarea></div>
<div class="wrapper-2">
<div class="class-name-2"><input id="id_term" name="term" value="AND ("dog"OR "cat")" type="hidden"/></div>
<div class="button-wrapper"><button class="search-btn" type="submit"><span class="text"> Search </span></button></div>
</div>
</form>
Folks
I am in need to construct a simple < a> tag. or another such mechanism such as < form> etc
There is a third party tool that does not takes arguments in the url.
But suppose at a certain endpoint "https://example.com/ticket" there is a form that performs a search on given tickets Number. I can head over there and manually type a ticket ID and submit the form and result is retrieved.
This tool has one input and one button
<input id="query" name="query" autocomplete="off" type="text">
<button> name="button" type="submit" class="btn"></button>
On my page I have list of tickets assign to certain users, and I am trying to construct an href link that will take the user to "https://example.com/ticket" in new window and reload the page with provide ticket ID in post method
something like following
TICKET-123
one of the option I tried is
<form action="https://example.com/ticket" method="post">
<input id="query" name="query" autocomplete="off" type="text" hidden>
<button> name="button" type="submit" class="btn" value="TICKET-123"></button>
</form>
Argument in the usr such as https://example.com/ticket?id=TICKET-123 would've been sweet, but form link does not work. what am I missing
Could you try something like this for the form sending a user to search.php
<form action="search" method="get" name="searchform" target="_self">
<input type="text" autocomplete="off" placeholder="Enter your ticket number" id="ticketnumber" name="ticketnumber">
<button class="button" type="submit">Search</button>
</form>
where search.php would contain the following
<?php
$ticketnumber = $_GET["ticketnumber"];
header("Location: https://example.com/ticket/$ticketnumber");
die();
?>
This would work if you just need to send users to an external site. As long as the pattern is like this. You then wouldn't need to reload the page if you can send the user to the URL correctly in the first instance.
Your question is a little vague but I think this approach could work because users then must input their ticket number instead of getting the inner text from the <a> tag. Let me know if you're looking at a different approach and please clarify how.
Also, if you didn't want to process this via PHP (I'd recommend it though because users can't see how it's done) you could go with the same form and the following
<form action="example.com/ticket/" method="get" name="searchform" target="_self">
<input type="text" autocomplete="off" placeholder="Enter your ticket number" id="ticketnumber" name="ticketnumber">
<button class="button" type="submit">Search</button>
</form>
Or you could use window.location.replace("https://example.com/ticket/#"); and place the ticket number where # is.
I'm using bootstrap-tokenfield
I'm using tokenfield in search bar, and have one small problem, lets say I search: searchtag1, searchtag2 and after I click on search and page loads my search resuts in search input there is no searchtag1, searchtag2
I want tags that I search for stay in input box on search page also, how to accomplish this?
I'm using default bootstrap form
<div class="search">
<form class="form-inline" role="form" action="{{ url('sonata_search') }}" method="GET">
<div class="form-group">
<input id="tags" class="form-control tokenfield" name="search" value="tag, tag2" placeholder="Search" type="text" />
<button type="submit" id="sonata_search_submit" class="btnbtn-default">
<i class="fa fa-search"></i>
</button>
</div>
</form>
</div>
You can use sessionStorage or localStorage, cookies or you can submit form with AJAX and just show submitted tags in input field on ajax success with no need for page reload.
Here is example with sessionStorage:
$(function() {
// on form submit set tags in sessionStorage
$('form').on('submit', function() {
var tagsValue = $('#tags').val();
sessionStorage.setItem('tags', tagsValue);
});
// if tags exist in sessionStorage set them as value in input field
var tagsSession = sessionStorage.getItem('tags');
if (tagsSession != null){
$('#tags').val(tagsSession);
}
$('#tags').tokenfield();
});
The HTTP protocol, and therefore web servers are stateless. Cookies and session variables are the easiest ways to get around that and implement cross-page state.
But there is a better way. It looks like you are using a laravel and blade, but this approach will work in generally the same fashion for any web server / library.
What you need to do is send the tags to the search "results" page. In the template you need to figure out some way to re-create the tags with the data you got back from the server.
I am writing a basic HTML Form which interfaces with JDBC to pass on the values to the DB.
Here are two lines of my code :
<form id="splash" action="http://localhost:8080/Practice01/DatabaseAccess" method="post">
<button type="submit" onclick="myFunction()" class="btn">Submit</button>
The current output is, when i submit the form, the pade is directed to http://localhost:8080/Practice01/DatabaseAccess. But i want to open another page on submit (or execute myFunction). A thank you page. How do i achieve this.
Any suggestions would be helpful.
create a code behind file to perform database operation and the redirect the code behind page to the page you want to open.
for example:
<form id="splash" action="<codebehindpage>" method="post">
<button type="submit" onclick="myFunction()" class="btn">Submit</button>
in the
response.redirect(<page you want to open>)