Select to view content in your preferred language

getting parameters in search esri geoportal

84
1
08-07-2024 12:39 PM
LuisFabres
New Contributor

Hi, how could I send a search parameter from another html page?

I have GeoPortal running at http://localhost:8080/geoportal-server-catalog-2.7.1.1/#homePanel.

Additionally, I have another web page in which I have a textbox where the user can add a text which must be searched in the metadata that already exists in the geoportal, specifically in the catalog.

-----------------------------------------
this is my html code for the another page..

<section class="search-bar">
<form id="searchForm" action="http://localhost:8080/geoportal-server-catalog-2.7.1.1/#searchPanel" method="get">
<input type="text" id="searchInput" placeholder="Search...">
  </form>
</section>

this is javascript code...
require(["dojo/ready"], function(ready) {
  ready(function() {
      // Code to handle search on main page
      var searchForm = document.getElementById('searchForm');
      if (searchForm) {
          searchForm.addEventListener('submit', function(event) {
              event.preventDefault();
              var query = document.getElementById('searchInput').value;
              if (query) {
                  window.location.href = 'http://localhost:8080/geoportal-server-catalog-2.7.1.1/#searchPanel?query=' + encodeURIComponent(query);
              }
          });}});});

 

This works correctly, since when you redirect the page to the catalog, it loads without problems.
When starting the catalog page, how can I read the redirect parameters?

 
0 Kudos
1 Reply
Marten
by
Regular Contributor

At the bottom of the Geoportal Server search page, you will find (by default) a series of links. If you take the WEB link there, it will result in opening the search page with the selection criteria applied. The selection criteria are included in the link. Here is an example from our public demo site:

Geoportal (geocloud.com)

0 Kudos