Link to home
Start Free TrialLog in
Avatar of thehaze
thehaze

asked on

FrontPage - Drop box

In FrontPage, I need to program a single web page with 2 drop boxes:

1. Choose Country
2. Choose Town

After which the relevant name and address of a customer is returned to an area on the same page.

Can this be coded using only HTML.?
Avatar of hhammash
hhammash

Hi,

1- Create a form
2- Insert Drop Down and name it Country
3- Insert Drop Down and name it Town
4- Give the values for Country
5- Give the values for Town
(The values can be setup by double clicking the Country drop down,  Name it Country, then click add and add your Option name and the value - Note the value is the value that is essential for the search)

Do the same for the Town Drop down.

Save your form as Search.asp

In Frontpage again
1- Create a new page
2- Go to Insert/Database Results
3- Select the database,  Next
4- Select the Record Source (Table)
5- Next
6- Click More Options
7- Click Criteria
8- Select Country=Country
9- Select Town=Town
10- Next until you reach step 5/5
11- Click Display all record
12- Uncheck Add search form then Click finish
13- Save your page as Results page
14- Go back to your Search.asp and open it
15- Right click inside the form and select form properties
16- Click Options
17- In the Action box type Results.asp
18- OK
19- Save your form

Test it.

Note in the values of the Dro down boxes you have to put the names of the Countries and cities as they are in the database.

Regards
hhammash
Avatar of thehaze

ASKER

Can this be done without using ASPs.?
Hi,

Yes without ASP Programming.

Just through FrontPage.

But If you mean that you don't want .asp extension it can not be.

Regards
hhammash
Well, yes it COULD possibly be without ASP... but there's a lot of info needed that you haven't supplied.

>>1. Choose Country
2. Choose Town

After which the relevant name and address of a customer is returned to an area on the same page.
>>

You have only ONE customer per town/country? Or many? How do you have them stored now? Do you have a database?

Regardless, you CANNOT do what you asked with only HTML. Some type of scripting is required -- whether you use a FP wizard, write your own, do it on the client or the server -- you still need something more than HTML.

And without knowing all the info needed, we can't really give any good answer.
Hi,

Your Search form can be HTM, but the results should be a Database Results and as I mentioned above,  you will only need FrontPage and MS Access to accomplish this. It is a very simple database function.

If your host supports ASP you can do it very easily.

Best regars
hhammash
Avatar of thehaze

ASKER

My host does not support asp. I was thinking more along the lines of using a drop box:
1. First to select Country.
2. After which the contents of the 'Town' dropbox are determined from the choice of country.

This being a mixture of drop boxes and htm's.
Hi,

What you need is called Dynamic Drop Down,  you will need ASP.

Since your host does not support ASP.  You can make it in PHP and MySQL.

Go to this Forum (it is good) register and post your question:
http://www.php-forum.com/p/index.php

Or can go here in Expert-Exchange site and post the question in the PHP forum.

This is the forum:
https://www.experts-exchange.com/Web/Web_Languages/PHP/

Best regards
hhammash
Avatar of CRagsdell
It can be done in HTML/JavaScript only, and doesn't require ASP. It does, however, require a lot more work...

You first form selects the country, which you use to decide what "Town" page to open using JavaScript.

Then build several pages with the appropraite list of towns in the drop-down.

Like I said, it can be done, but not very efficiently...

CR

Avatar of thehaze

ASKER

How can it be done using only HTML/JavaScript:?  
Create a country page based on the following example. Then build all the various pages you need for each country with the appropriate towns in a drop down.

<html>

<head>
<title>Countries</title>
</head>

<body>

<script Language="JavaScript" Type="text/javascript">

<!--
function FormValidator(theForm)
{

  if (theForm.Country.selectedIndex == 0)
  {
    alert("The first \"Country\" option is not a valid selection.  Please choose one of the other options.");
    theForm.Country.focus();
    return (false);
  }

  if (theForm.Country.selectedIndex == 1)
  {
    window.open("USA.htm");
    return (false);
  }

  if (theForm.Country.selectedIndex == 2)
  {
    window.open("GB.htm");
    return (false);
  }

  if (theForm.Country.selectedIndex == 3)
  {
    window.open("CN.htm");
    return (false);
  }

  return (true);
}

//-->
</script>

<form method="POST" post="countries.htm" onsubmit="return FormValidator(this)" language="JavaScript" name="Form1">

  <p>
  <select size="1" name="Country">
    <option value="0">-Select One-</option>
    <option value="USA">USA</option>
    <option value="GB">Great Britain</option>
    <option value="CN">Canada</option>
  </select>
  <input type="submit" value="Submit" name="Submit">
  <input type="reset" value="Reset" name="Reset">
  </p>
</form>
&nbsp;


</body>

</html>
Hi,

thehaze want to select a country then a city and when he/she submits the form he/she wants other data to be displayed

Quote
After which the relevant name and address of a customer is returned to an area on the same page
End Quote

If he/she just want to select and option from the drop down and go to the URL he/she can use the Jump Menu.

From what I understood he will required databases. It should be PHP since his/her host does not support ASP.

thehaze,  try and post this problem in the PHP forum, you might get an answer.

hhammash
If thehaze has to stay on the same page, just do a document write of the Towns drop down instead...

Still, no database needed...

Still all in JS and HTML, no ASP OR PHP needed.

And, BTW, isn't a Jump Menu just a select form with the appropriate JavaScript to jump from one page to the next... like what I shared with thehaze.

Of course, mine wasn't generated by DreamWeaver.

CR
Hi,

I know that the code was not generated by DreamWeaver,  and your code does the same, my question was How to display related Address with JavaScript.

The question is:
----------------

Where can he store Coutnries and Cities and Customer information and how to retrieve them?

CR,
I am asking not because I want to show that it can not be done, but because I would like to know.

How can you modify your code to display related information.

CR I am not criticizing your code, on the contrary I would like to see how can this be done without a DB. Sorry if you felt angry from my post.  I did not mean anything.


Thank you CR
hhammash
He can store the info in a js file -- create an array, and use that. If it's a separate .js file, you can even have multiple versions with only ONE processing module/.js file. I've done this, it works very well.

And you can have the dropdown be populated by the javascript, based on the selection from the first dropdown. Again, no database required and no reloading of the page. It's a bit tricky though.
webwoman,

Thanks for helping answer hhammash's question.

It IS possible with no PHP or ASP, but a heck of a lot easier with a database-driven system.

CR
Hi CRgagsdell and Webwoman,

It is good that it can be done without Databases.
But you did not yet show thehaze how to do that and what is involved if he/she has hundreds of URLs and record.  Also you did not mention the volume of data that can be stored in a JS file and how to manipulate them in terms or sorting, searching ...etc.

I would like to see that too.


Thank you for your replies
hhammash
Avatar of thehaze

ASKER

I have 4 countries. For each country there are 10-15 towns.

How is this information stored in the one JS file, without a database and no reloading of the page.?
For example:
England --> London
            Manchester
            Liverpool --> Smith Ltd.
                          Jones Ltd.
in the <HEAD>

<script language="JAVASCRIPT">
var browser_type=navigator.appName

var englandArray = new Array("London", "Manchester")
var liverpooleArray = new Array("Smith LTD", "Jones LTD")

function updateList(theForm, catName, subjListLength){
    for (var i=subjListLength + 1 ; i > 0 ; i-- )
    {
      theForm.Subject.options[i] = null
    }
      if( catName == "None"){
            var option0 = new Option("- Please Choose a Category Above -", "None")
      }
      else{
            eval('var option0 = new Option("- Please Choose -", "None")')
      }
      
       NSL=0
    if (catName != "None") {
          eval("var NewSource = " + catName +"Array")
          NSL = NewSource.length
              for(var L = 0; L < NSL + 1; L++)  {
             eval("var option" + [L + 1] + " = new Option(" + '"' + NewSource[L] + '", "' + NewSource[L] + '")')
             }
    }
    for (var i=0; i < NSL + 1; i++) {
            eval("theForm.Subject.options[i]=option" + i)
        if (i==0) {
         theForm.Subject.options[i].selected=true
        }
    }
if (browser_type=="Netscape")
   { history.go(0) }
}
</script>

And then in the <BODY>:

                      <select name="Category" size="1" onChange="updateList(this.form, this.options[selectedIndex].value, this.form.Subject.length)">
                        <option value="None"  Selected >- Please Choose - </option>
                        <option value="england" >England </option>
                        <option value="liverpoole" >Liverpoole </option>
                      </select>

                      <select name="Subject" id="Subject">
                        <option value="None" SELECTED>- Please Choose a Category  Above - </option>
                      </select>


That is if I understand the question correctly.  If not please either accept an answer or request it be deleted.  

Thank you!
-Corey
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
PAQ / No Refund
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

coreybryant
EE Cleanup Volunteer
ASKER CERTIFIED SOLUTION
Avatar of YensidMod
YensidMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial