472,959 Members | 1,822 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,959 software developers and data experts.

Easiest way to include a form on multiple pages? (Beginner Question)

jan
My apologies for being a javascript beginner and asking such a basic
question. This is probably so easy that nobody ever mentions it.
Tutorials and places that tell of basic commands never seem to mention
what I want to do. I've looked into SSI, shtml, external javascript,
css, and html commands. There seems to be many solutions, but I would
like to focus on using the best and easiest solution.

I have a website with more than 1000 pages. I've built a form into
every page that links to a couple hundred major cities. It looks like
this:

<form name="majoruscities" onSubmit="return false;">
<select name="select"
onChange="window.document.location=window.document .majoruscities.select.value;">
<option value="#" selected>Major US Cities</option>
<option value="../ny/albany.html">Albany NY</option>
..
<option value="../ma/worcester.html">Worcester MA</option>
</select>
</form>

It works real good, and when I use website software it is easy to make
a change and have it appear throughout a web site.
However, this is a situation in which I am writing much of the html and
js manually. My methods seem very wasteful.
Instead of having the entire form be part of every html page I want to
call most of it seperately, from one source file. That way, if I want
to add, change, or remove a link from the form, I don't have to
regenerate every page. Also, it won't take up unnecessary space, and
won't have unnecessary upload times when I change them.

I imagine the easiest way would take a format something like what is
used to get an image source?????
<img src="../images/picture.jpeg">

Of all the solutions that work, which is preferred? Link to a good
example?
Thanks,
Jan

Apr 21 '06 #1
6 1800
jan said the following on 4/21/2006 5:03 PM:
My apologies for being a javascript beginner and asking such a basic
question. This is probably so easy that nobody ever mentions it.
Tutorials and places that tell of basic commands never seem to mention
what I want to do. I've looked into SSI, shtml, external javascript,
css, and html commands. There seems to be many solutions, but I would
like to focus on using the best and easiest solution.


Best and easiest? SSI.

Simpler but more error prone? Put your form in an iframe and put the
iframe on all pages.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 21 '06 #2
jan
I started heading in that direction, made a couple attempts that
failed, but will try harder. Thanks!

Apr 21 '06 #3
jan wrote:
[...] I've looked into SSI, shtml, external javascript,
css, and html commands.
Much you have to learn, young apprentice ...

SHTML is simply SSI-enhanced HTML.
What do you think is "external javascript"?
CSS is a layout language. There are selectors and rules; no commands.
HTML is a markup language. There are elements and attributes; no commands.
There seems to be many solutions, but I would
like to focus on using the best and easiest solution.
That solution is certainly _not_ (only) client-side scripting.
I have a website with more than 1000 pages.
Those are documents, not pages. Each one consists of pages if displayed
in a paged medium; not in a graphical Web browser, for example; that is
continuous display (scrollbars).
I've built a form into every page that links to a couple hundred major
cities. It looks like this:

<form name="majoruscities" onSubmit="return false;">
<select name="select"
onChange="window.document.location=window.document .majoruscities.select.value;"> <option value="#" selected>Major US Cities</option>
<option value="../ny/albany.html">Albany NY</option>
.
<option value="../ma/worcester.html">Worcester MA</option>
</select>
</form>
There is no point in this `form' element. And users without client-side
script support cannot navigate to any of your many "pages". And keyboard
users will have problems selecting anything. And nobody will wait until
all your "couple hundred" "links" are loaded. And ...
It works real good,
Perhaps on your local machine/server or with a broadband connection to the
remote server.
and when I use website software it is easy to make
a change and have it appear throughout a web site.
So users are forced to download all that stuff they do not need, every time.
Great.
However, this is a situation in which I am writing much of the html and
js manually. My methods seem very wasteful.
Your entire approach is wrong.
Instead of having the entire form be part of every html page I want to
call most of it seperately, from one source file. That way, if I want
to add, change, or remove a link from the form, I don't have to
regenerate every page. Also, it won't take up unnecessary space, and
won't have unnecessary upload times when I change them.
What you really want is to split that list, organize it into countries, for
example; set up a search feature if necessary, and, most important, not to
rely on enabled client-side script support for basic navigation.
I imagine the easiest way would take a format something like what is
used to get an image source?????
<img src="../images/picture.jpeg">
Thereby making bad things even worse? Definitely not.
Of all the solutions that work,
For appropriate values of "work".
which is preferred?
Client-side scripting supported by server-side scripting, meeting the
requirements I mentioned above.
Link to a good example?


No. You have much greater problems than client-side scripting here, so
comp.infosystems.www.authoring.misc is where you should start instead
(probably they have a FAQ that explains the basics of Web authoring).

But if you come up with _reasonable_ code that does not work despite
your best efforts, you will receive help here regarding the client-side
scripting part of your problem.
HTH

PointedEars
Apr 21 '06 #4

"Randy Webb" <Hi************@aol.com> wrote in message
news:Jd******************************@comcast.com. ..
jan said the following on 4/21/2006 5:03 PM:
My apologies for being a javascript beginner and asking such a basic
question. This is probably so easy that nobody ever mentions it.
Tutorials and places that tell of basic commands never seem to mention
what I want to do. I've looked into SSI, shtml, external javascript,
css, and html commands. There seems to be many solutions, but I would
like to focus on using the best and easiest solution.


Best and easiest? SSI.

Simpler but more error prone? Put your form in an iframe and put the
iframe on all pages.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/


Can you explain "ssi" and "I Frame"?
May 4 '06 #5
ASM
Prophet a écrit :
"Randy Webb" <Hi************@aol.com> wrote in message
news:Jd******************************@comcast.com. ..
jan said the following on 4/21/2006 5:03 PM:
My apologies for being a javascript beginner and asking such a basic
question. This is probably so easy that nobody ever mentions it.
Tutorials and places that tell of basic commands never seem to mention
what I want to do. I've looked into SSI, shtml, external javascript,
css, and html commands. There seems to be many solutions, but I would
like to focus on using the best and easiest solution.
Best and easiest? SSI.

Simpler but more error prone? Put your form in an iframe and put the
iframe on all pages.


Can you explain "ssi" and "I Frame"?

SSI = Server Side Includes
http://www.irt.org/articles/js166/index.htm
your pages must have shtml as extension
Works only on a server
(doesn't work in local on your computer except if opened in a web server)

insert this code where you want your form :
<!--#include virtual="/formCities.txt" -->

and at root of your site you have a file 'formCities.txt' containing :
<form name="majoruscities" onSubmit="return false;">
<select name="select"
onChange="window.document.location=window.document .majoruscities.select.value;">
<option value="#" selected>Major US Cities</option>
<option value="../ny/albany.html">Albany NY</option>
..
<option value="../ma/worcester.html">Worcester MA</option>
</select>
</form>
iframe = a frame inside each page where you want your form
(my NC4.5 doesn't understand 'iframe' !)

insert this code where you want your form :
<iframe src="/formCities.html" width="300" height="50">
Your browser doesn't understand iFrame, please go here :<br>
<a href="/formCities.html">Cities menu</a>
</iframe>

and at root of your site you have a file 'formCities.html' containing :
<html>
<form name="majoruscities" onSubmit="return false;">
<select name="select"
onChange="window.document.location=window.document .majoruscities.select.value;">
<option value="#" selected>Major US Cities</option>
<option value="../ny/albany.html">Albany NY</option>
..
<option value="../ma/worcester.html">Worcester MA</option>
</select>
</form>
</html>

--
Stephane Moriaux et son [moins] vieux Mac
May 4 '06 #6
ASM said the following on 5/4/2006 5:08 AM:
Prophet a écrit :
"Randy Webb" <Hi************@aol.com> wrote in message
news:Jd******************************@comcast.com. ..
jan said the following on 4/21/2006 5:03 PM:

My apologies for being a javascript beginner and asking such a basic
question. This is probably so easy that nobody ever mentions it.
Tutorials and places that tell of basic commands never seem to mention
what I want to do. I've looked into SSI, shtml, external javascript,
css, and html commands. There seems to be many solutions, but I would
like to focus on using the best and easiest solution.

Best and easiest? SSI.

Simpler but more error prone? Put your form in an iframe and put the
iframe on all pages.


Can you explain "ssi" and "I Frame"?

SSI = Server Side Includes
http://www.irt.org/articles/js166/index.htm
your pages must have shtml as extension


Complete and utter nonsense. Even the page you cite says differently:

<quote>
Finally, you may activate SSI's for all files or only for files with a
special file extension (usually shtml).
</quote>

You can find that with a search of that page for shtml, its the first find.

What extensions that are allowed to do includes depends on server setup.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 4 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Rolf Hemmerling | last post by:
Hello ! Beginner's question: What ist the easiest way to store and save objects in a file generated by a C++ program, by using the "standard C++ library" and/or "Standard Template Library (...
4
by: William Wisnieski | last post by:
Hello Everyone, Access 2000 I have a form with multiple pages on it. There is one text field on the third page of the form that I need the user to complete before leaving the form or moving...
6
by: tshad | last post by:
In my User control, I tried to do this: *************************************************************************** <Script runat="server"> Public ClientName As String = "<!-- #include file =...
3
by: Wayne Wengert | last post by:
I am rewriting some ASP pages to move them to ASP.NET (VB). The old pages had some include files such as one that had the subroutine to create a connection as well as the code that invoked that...
23
by: Big Bill | last post by:
http://www.promcars.co.uk/pages/bonnie.php I don't believe they should be there, can I take them out without stopping the includes from functioning? I'm the (hapless) optimiser on this one... I...
4
by: Alex Maghen | last post by:
I have a master page which contains a general page framework and also contains a <form runat=server> around most of the content of the page. Inside that <form> tag is a ContentPlaceholder. I...
1
by: Ranginald | last post by:
Hi, I have an asp.net project and I am in the process of trying to make it into a truly object-oriented project -- as I have just learned I cannot have multiple codebehind files in a single...
6
by: Joseph Geretz | last post by:
I have the following class which I am serializing and passing back and forth between my Web Service application and the client. public class Token : SoapHeader { public string SID; public...
10
by: vladimirblotan | last post by:
Hi, I'm trying to create a dynamic form that is accessed from multiple pages. I've created the form and included into one of the main PHP pages using the include() function. Now, when I run...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.