I am trying to use PHP cURL to fill and submit a form on a url, however, they are not using the regular form
tag with a submit button. Instead they just have a div with onclick
to submit the value entered in the input
field that has no name
, but does have an id
and an onChange
event.
You can see it in action here. (You can search for '5458-011' to test.)
How do I still enter a value in this input
field and submit it via cURL?
以下是该网址的代码。
HTML:
<input onChange="mirrorSearch2()" list="addresses2"class="Header-Search-field" id="addressInputSmall" placeholder="Search by address, parcel or planning application number, or click on the map"/>
<datalist id="addresses2"></datalist>
<div onclick="runSearch(document.getElementById('addressInputSmall').value,'','addressInputSmall')" class="fa fa-search fa-2x" aria-hidden="true" id="Search-icon2"></div>
Javascript / jQuery:
//onChange
function mirrorSearch2() {
var thenew=$('#addressInputSmall').val()
//console.log(thenew);
$('#addressInput').val(thenew);
}
function mirrorSearch() {
var thenew=$('#addressInput').val()
//console.log(thenew);
$('#addressInputSmall').val(thenew);
}
//onClick
function runSearch(theAddress,theType,theID) {
//Now run a second query to get the geometry, if no geometry is found then send to old PIM search functionality (e.g. PPTS non-parcel records)
//console.log("RunSearch: "+theAddress)
if (theID=="addressInput") {
//console.log($('#addresses').children().length)
if ($('#addresses').children().length==1 ) {
//if there is only one option and they hit enter, then get the option value rather than search for the incomplete text.
//e.g. if they typed 1650 miss and hit enter, then send the 1650 MISSION ST from the option list.
$("#addresses").prop("selectedIndex", 0);
if ($( "#addresses option:first" ).val()) {
setTimeout('throttleSubmit($( "#addresses option:first" ).val());',400)
return
//theAddress = $( "#addresses option:first" ).val();
}
}
}
if (theID=="addressInputSmall") {
//console.log($('#addresses2').children().length)
if ($('#addresses2').children().length==1 ) {
//if there is only one option and they hit enter, then get the option value rather than search for the incomplete text.
//e.g. if they typed 1650 miss and hit enter, then send the 1650 MISSION ST from the option list.
$("#addresses2").prop("selectedIndex", 0);
if ($( "#addresses2 option:first" ).val()) {
setTimeout('throttleSubmit($( "#addresses2 option:first" ).val());',0)
return
//theAddress = $( "#addresses2 option:first" ).val();
}
}
}
//setTimeout('console.log($( "#addresses2 option:first" ).val())',100)
//console.log(theAddress)
throttleSubmit(theAddress)
}