7 Replies Latest reply: Oct 16, 2014 5:13 AM by gdavisdesign RSS

    Webapp address search form-search by state

    gdavisdesign Community Member

      I have a location-based search and I am trying to get the states listed in a webapp search form dropdown. I can add in the dropdown, but it isn't part of the search. I would like the ability for the user to search by state only, not having to enter a zip code. When I try this, all of the items in the webapp are displayed in the results.

       

      Since the State is part of the address and not a custom field, how do I include it as part of the search script? When I output the search form, state isn't part of that, only zip and country.

       

      Does everything have to be determined by the ZIP code?

       

      Also, with international addresses, can I just have a search based on Country and no postal code?

        • 1. Re: Webapp address search form-search by state
          Liam Dilley CommunityMVP

          The BC proximity search does not work like that. You would have to make a custom field and use that when you get that from the search form.

          Zip along with country is the method for the proximity search BC uses.

          It needs a point of origin, like searching on a map to know how to run the distance from. If you said country that is very broad.

          • 2. Re: Webapp address search form-search by state
            gdavisdesign Community Member

            So the only way to search addresses is by zip code ? You can't search all the zip codes in a particular state?

             

            I guess I have to create my own address input fields for an address. This seems odd. There has to be a way to use the available address fields and search by state, or country for that matter- without having to enter a zip.

             

            My main goal is to have my client enter the addresses of their distributors and display them on a map and list view for the site viewers to search. I can have the viewer enter a zip code, but because there aren't that many distributors - it would be nice to bypass the zip and just display distributors in the selected state. And for countries in Europe, a search by country would be good.

             

            If you have any suggestions as to where I might look to get this functionality I would appreciate it. Thanks

            • 3. Re: Webapp address search form-search by state
              Liam Dilley CommunityMVP

              IF your displaying on a map then you can use the address tags and the geocoder with the google v3 map api.

              Of that you can use and form what you want.

              https://developers.google.com/maps/documentation/geocoding/

              • 4. Re: Webapp address search form-search by state
                rambo_amadeus Community Member

                Hey gdavisdesign,

                 

                Have you managed to make the search form filter by state? I followed the naming syntax other fields have e.g. postcode field name is Postcode_11189 and tried State_11189 and it didn't work. It looks like the state is the only web app field that can't be searched, but it needs to be supplied as part of the address in order for BC to geocode the location properly.

                 

                If anyone has an answer to this other than creating another field for that purpose I'd love to hear it.

                 

                Cheers,

                 

                Mario

                • 5. Re: Webapp address search form-search by state
                  Liam Dilley CommunityMVP

                  Hi Mario,

                  I gave the answer by using the google API Geocoding and matching the required data and outputting the results.

                  • 6. Re: Webapp address search form-search by state
                    mario_gudelj CommunityMVP

                    Hey Liam,

                     

                    I can't see how you can use that to filter the listings. I'm not interested

                    int he map. I just need to filter the listings for a particular state.

                     

                    Cheers,

                     

                    m

                     

                     

                     

                     

                    On Mon, Sep 29, 2014 at 11:26 PM, Liam Dilley <forums_noreply@adobe.com>

                    • 7. Re: Webapp address search form-search by state
                      gdavisdesign Community Member

                      Hi Mario,

                      Sorry for the late reply. I managed to make this happen by creating another Field in the WebApp called "State2". It's a dropdown with the sates listed. The state is selected by my client when they enter a new dealer address in to the WebApp (basically entering the address state twice.)

                       

                      Then there was some other JS to make it work, from what I remember. I would have to go back and look at the code, as it has been a while since I worked on this.

                       

                      I'm not sure if that's the solution you are looking for, but if you would like me to look at it again and post how I did it, I can.

                       

                      Thanks,

                      Greg