PC Review


Reply
Thread Tools Rate Thread

CAPTURING TEXT FOR FORM

 
 
=?Utf-8?B?dGVycnk=?=
Guest
Posts: n/a
 
      5th May 2006
I have a web page with a link to a form. what I would like to do is capture,
the page title, and have it placed in the first field on the form so the user
will not have to type it in.
--
Terry
 
Reply With Quote
 
 
 
 
Jon Spivey
Guest
Posts: n/a
 
      5th May 2006
Hi Terry,

<form.....
<input type="text" name="PageTitle">
......
</form>
<script type="text/javascript">
if(document.title(document.forms[0].elements[0].value=document.title);
</script>

--
Cheers,
Jon
Microsoft MVP

"terry" <(E-Mail Removed)> wrote in message
news:07B6538F-14A6-4316-80E5-(E-Mail Removed)...
>I have a web page with a link to a form. what I would like to do is
>capture,
> the page title, and have it placed in the first field on the form so the
> user
> will not have to type it in.
> --
> Terry



 
Reply With Quote
 
Trevor L.
Guest
Posts: n/a
 
      6th May 2006
Jon Spivey wrote:
> Hi Terry,
>
> <form.....
> <input type="text" name="PageTitle">
> .....
> </form>
> <script type="text/javascript">
> if(document.title(document.forms[0].elements[0].value=document.title);
> </script>


Jon,
This assumes that the form is is the first form on the page and that the
text field is the first field in the form.

Wouldn't the code below be more robust (and I think there is a typo) ?

<form id="form1" .....
<input id="field1" type="text" name="PageTitle">
......
</form>
<script type="text/javascript">
if(document.title)
document.forms['form1'].elements['field1'].value=document.title);
</script>

--
Cheers,
Trevor L.
Website: http://tandcl.homemail.com.au


 
Reply With Quote
 
Trevor L.
Guest
Posts: n/a
 
      6th May 2006
Trevor L. wrote:

> Wouldn't the code below be more robust (and I think there is a typo) ?

[snip]

I made a typo myself
<script type="text/javascript">
if(document.title)
document.forms['form1'].elements['field1'].value=document.title;
</script>

;-))
--
Cheers,
Trevor L.
Website: http://tandcl.homemail.com.au


 
Reply With Quote
 
=?Utf-8?B?dGVycnk=?=
Guest
Posts: n/a
 
      6th May 2006
Thank you for the help, I should have mentions that I am new to front page so
if you could tell me where this code is to go "On page or the button to
connect to the form or on the form it's self"

Thanks again
--
Terry


"Jon Spivey" wrote:

> Hi Terry,
>
> <form.....
> <input type="text" name="PageTitle">
> ......
> </form>
> <script type="text/javascript">
> if(document.title(document.forms[0].elements[0].value=document.title);
> </script>
>
> --
> Cheers,
> Jon
> Microsoft MVP
>
> "terry" <(E-Mail Removed)> wrote in message
> news:07B6538F-14A6-4316-80E5-(E-Mail Removed)...
> >I have a web page with a link to a form. what I would like to do is
> >capture,
> > the page title, and have it placed in the first field on the form so the
> > user
> > will not have to type it in.
> > --
> > Terry

>
>
>

 
Reply With Quote
 
Trevor L.
Guest
Posts: n/a
 
      7th May 2006
terry wrote:
> Thank you for the help, I should have mentions that I am new to front
> page so if you could tell me where this code is to go "On page or
> the button to connect to the form or on the form it's self"


I am not Jon, but perhaps I can answer

I have made a few replies to your post and got them a bit wrong ,so this
time I hope I get it right.

To amend your form, go to Code or HTML view - the tab down the bottom and
find the HTML code for the form

Your form tag should read
<form id ="form1" ......>
Leave the rest the same

The input tag you want the title in should read
<input id="field1" type="text" ........>

Leave the rest the same

Then, anywhere after the </form> tag, add
<script type="text/javascript">
if(document.title)
document.forms["form1"].elements["field1"].value=document.title;
</script>

If I am wrong, no doubt Jon will correct me
--
Cheers,
Trevor L.
Website: http://tandcl.homemail.com.au


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Capturing selected text in a text box Robin S. Microsoft Access Form Coding 4 21st Sep 2009 04:25 PM
capturing text to the right dstiefe Microsoft Excel Programming 3 4th Sep 2009 08:31 PM
RE: Capturing Selected Text Walter Wang [MSFT] Microsoft ASP .NET 0 9th Jan 2007 02:24 AM
RE: Capturing text from a window Mohamoss Microsoft VB .NET 0 27th Dec 2004 02:45 PM
Capturing a Value in a Text box before update Nadine Microsoft Access Queries 1 22nd Nov 2003 03:29 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:12 AM.