Populating form field with title/url

J

JoyDee

Ok. I give up. I've searched this site, the web, and my books, but I just
cannot figure this seemingly simple thing out. I want to populate a hidden
field in a form with the title of the page. Can you point me to the right
syntax?
 
J

Jon Spivey

Hi,
stick a field on the page
<form......
<input type="hidden" name="title" value="">
</form>
and then below the script to populate it
<script type="text/javascript">
document.forms[0].title.value=document.title;
</script>
 
R

Rob Giordano \(Crash\)

I'm trying to imagine why you'd do this? It's not like the form migrates
from page to page, couldn't you (op) just put the page title in a hidden
field?

curious.


| Hi,
| stick a field on the page
| <form......
| <input type="hidden" name="title" value="">
| </form>
| and then below the script to populate it
| <script type="text/javascript">
| document.forms[0].title.value=document.title;
| </script>
|
| --
| Cheers,
| Jon
| Microsoft MVP
|
| | > Ok. I give up. I've searched this site, the web, and my books, but I
just
| > cannot figure this seemingly simple thing out. I want to populate a
| > hidden
| > field in a form with the title of the page. Can you point me to the
right
| > syntax?
|
|
 
J

Jon Spivey

The only reason I can think of is this code can be used on several pages
without change. I assumed the guy would know how to do
<input type="hidden" name="title" value="The title of this page">
So he wanted a script solution.

I just answer the questions, not try to analyse them ;-)
 
T

Thomas A. Rowe

The form could be on a page that is being included in other pages.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================

Jon Spivey said:
The only reason I can think of is this code can be used on several pages without change. I assumed
the guy would know how to do
<input type="hidden" name="title" value="The title of this page">
So he wanted a script solution.

I just answer the questions, not try to analyse them ;-)

--
Cheers,
Jon
Microsoft MVP

Rob Giordano (Crash) said:
I'm trying to imagine why you'd do this? It's not like the form migrates
from page to page, couldn't you (op) just put the page title in a hidden
field?

curious.


| Hi,
| stick a field on the page
| <form......
| <input type="hidden" name="title" value="">
| </form>
| and then below the script to populate it
| <script type="text/javascript">
| document.forms[0].title.value=document.title;
| </script>
|
| --
| Cheers,
| Jon
| Microsoft MVP
|
| | > Ok. I give up. I've searched this site, the web, and my books, but I
just
| > cannot figure this seemingly simple thing out. I want to populate a
| > hidden
| > field in a form with the title of the page. Can you point me to the
right
| > syntax?
|
|
 
J

JoyDee

Actually, I'm experimenting with a new project. Using Contribute, I'd like
to enable other people in the organization to post customer-related documents
along with a form that emails back a response (approve/disapprove). I need
the form results to identify what documents are being approved. The easiest
way to do this (without using a database or Sharepoint, which for several
reasons would not be feasible in this particular effort) would be to use this
form in a template, the page being saved to a unique name, and that unique
name be included in the hidden field.

This script worked for me beautifully - except I'm used to Frontpage and
Contribute really works well with Dreamweaver. Both of which I have. Now, I
need to figure out forms in Dreamweaver.

Jon Spivey said:
The only reason I can think of is this code can be used on several pages
without change. I assumed the guy would know how to do
<input type="hidden" name="title" value="The title of this page">
So he wanted a script solution.

I just answer the questions, not try to analyse them ;-)

--
Cheers,
Jon
Microsoft MVP

Rob Giordano (Crash) said:
I'm trying to imagine why you'd do this? It's not like the form migrates
from page to page, couldn't you (op) just put the page title in a hidden
field?

curious.


| Hi,
| stick a field on the page
| <form......
| <input type="hidden" name="title" value="">
| </form>
| and then below the script to populate it
| <script type="text/javascript">
| document.forms[0].title.value=document.title;
| </script>
|
| --
| Cheers,
| Jon
| Microsoft MVP
|
| | > Ok. I give up. I've searched this site, the web, and my books, but I
just
| > cannot figure this seemingly simple thing out. I want to populate a
| > hidden
| > field in a form with the title of the page. Can you point me to the
right
| > syntax?
|
|
 
R

Rob Giordano \(Crash\)

ah i see, thanks.


| The form could be on a page that is being included in other pages.
|
| --
| ==============================================
| Thomas A. Rowe (Microsoft MVP - FrontPage)
| ==============================================
| If you feel your current issue is a results of installing
| a Service Pack or security update, please contact
| Microsoft Product Support Services:
| http://support.microsoft.com
| If the problem can be shown to have been caused by a
| security update, then there is usually no charge for the call.
| ==============================================
|
| > The only reason I can think of is this code can be used on several pages
without change. I assumed
| > the guy would know how to do
| > <input type="hidden" name="title" value="The title of this page">
| > So he wanted a script solution.
| >
| > I just answer the questions, not try to analyse them ;-)
| >
| > --
| > Cheers,
| > Jon
| > Microsoft MVP
| >
message
| > | >> I'm trying to imagine why you'd do this? It's not like the form
migrates
| >> from page to page, couldn't you (op) just put the page title in a
hidden
| >> field?
| >>
| >> curious.
| >>
| >>
| >> | >> | Hi,
| >> | stick a field on the page
| >> | <form......
| >> | <input type="hidden" name="title" value="">
| >> | </form>
| >> | and then below the script to populate it
| >> | <script type="text/javascript">
| >> | document.forms[0].title.value=document.title;
| >> | </script>
| >> |
| >> | --
| >> | Cheers,
| >> | Jon
| >> | Microsoft MVP
| >> |
| >> | | >> | > Ok. I give up. I've searched this site, the web, and my books, but
I
| >> just
| >> | > cannot figure this seemingly simple thing out. I want to populate
a
| >> | > hidden
| >> | > field in a form with the title of the page. Can you point me to the
| >> right
| >> | > syntax?
| >> |
| >> |
| >>
| >>
| >
| >
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top