• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Make linked text appear in a field on page linked to?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI,

I've spent all day searching the web, most of it at W3Schools, trying to figure this out. I post a class schedule on my site. It's just a list of dates, each one surrounded by <a href="Signup form"> tags.

The signup form set up so it sends me a request email with the 'date desired' field contents as the subject line. I would like to fill that field in for them with the date they clicked on to link to the form.

I've spent the day going through every example and see some real possibilities,(alertValue, changeText) but I'm unsure If they should go on the schedule page or the form page.

I should admit that a friend set the site up for me but I've been maintaining it without help ever since. Figured out how to add and even heavily modify pages and will continue to do so. I'm just stuck for the moment and could really use some clues as to which direction to go. I've got the whole thing set up offline, but javascript trial and error is a little slower than html and css were.

Below is the form I am linking them to. I believe the solution will go in between the link tags on the schedule page and also on the process.php document but need to narrow things a little more before I start trying things.



In a nutshell, how do I make the date they clicked on on the schedule page appear as the value in the 'date desired' box on the form page?

Thanks for looking at this.

Greg

[ February 03, 2008: Message edited by: Greg Pugh ]
[ February 03, 2008: Message edited by: Greg Pugh ]
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where are these list of dates: In the same window? In a pop up window?

same window

pop up window

Eric
 
Greg Pugh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you click on the date the new page with the signup form opens in the existing window.

I decided onClick was it late last night. The list of dates is on the index page. The links take you to the signup page where the form code I posted is. The main thing I'm getting stuck on is the path that gets the text on the index page inserted as the value in the date desired field on a different page.

Every tutorial and example I can find shows how to do it on the same page.

Am I just charting the path like your second example?

By the way, I'm using this as a learning experience because there are other things I need to apply the knowledge to. It will be nice to have the date filled out for them but eventually, after I learn a little javascript, My goal is to use it to put a price and item in two different fields on a credit card gateway from my other site where I sell books.

Your help confirming that I'm on the right track saves me much time and worry. I appreciate it.

Greg

[ February 04, 2008: Message edited by: Greg Pugh ]
[ February 04, 2008: Message edited by: Greg Pugh ]
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are navigating to a new page in the same window. You need to pass the data in the querystring.

Ideally you would have the server put the value into the textbox, but this is how you would do it with JavaScript.

Your link with the querystring value:


The code on the next page:



make sure to change it to your form and element name.

Eric
[ February 04, 2008: Message edited by: Eric Pascarello ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why aren't you handling this in your server-side code?
 
Greg Pugh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eric,

Wow, that's a lot to digest, but I bet by tonight I'll have dissected it and looked up everything in it. What isn't apparent to me after that I may ask you to explain.

I see there's a body onload to preload the images. And I read in your book that you only get one onload command. Will this be a problem?

While you were doing that I was reading sample pages of your book. It looks like it will be my next read. Your explanations make it relatively simple to understand.

Bear,

The answer is I didn't write any of this originally. My friend set up a very basic css template he got on the net and formatted my straight html pages with it just to get me started. I made the 'sign up' form by looking at the code for the simple 'contact us' form he made and adding fields and information for the new purpose. When you're basically going through a monkey-see, monkey-do exercise, adding server side scripting has to wait until you're no longer 'behindthecurve'

(I went back to school to take some html classes a year or two ago. Studied css at w3schools after he used it to give all my pages the same look a year ago and have been into javascript for only a week.)

Thanks guys.

Greg
[ February 04, 2008: Message edited by: Greg Pugh ]
 
Greg Pugh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings,

OK, this is where I am so far. The new code is in place on both pages and it all works like normal but is not filling in the field yet.
Changing to MY form and element name , I think, is the trouble. I can't find the form name anywhere on that page's code, but I did find something on the config document (see below).

He has the element in question called 'date desired'. Should I write it as 'datedesired' or 'date_desired'? I feel like the space is part of the problem because I remember reading somewhere that you can't have them in element names.
I used an underscore to connect two separate words in both the form and the element like it was in the config document but to no avail. Still, I'm not 100 percent sure I'm even calling the form by the correct name so that could be a problem as well. Am I correct in assuming the form name is not case sensitive?

This is the part where I made the change. I changed 'on' to 'no' after 'window.' on line one to get the system to let me post this. It is correct where I used it on my page. I'm sure there's a better way but I'm new at this.


The only place I found a reference to what the form name might be was
on my config.php document. Here it is:



Thanks again guys, It's great to have found someone I can ask about this.
It could all wind up being just an educational exercise because further research tells me I should indeed be looking to do this server-side with PHP and to that end I ordered a book on PHP when I ordered Eric's book yesterday.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well if there is no form name, you can reference it with

document.forms[0].elementName

Yeah, element names can not have spaces. Should be an underscore or smash it together.

Eric
 
Greg Pugh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I've read the books and it's all clear as mud now.
I still don't have it working yet but I found some tutorials that look like they're pretty good, so I'm off to do those.
This is where it is at the moment:



of course the end of the url in the browser bar looks like this:

signupdate.html?date=Thur6Mar

Thanks for any thoughts,

Greg
 
Greg Pugh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I've figured out why I can't find the form name to make this work.
look at this:

These two lines precede the four text fields on the destination page

The form the test field I'm trying to fill in with a date embedded in the browser is PHP and running from a different document. This would seem to make Bear's question all the more relevant. I think I SHOULD be doing this server side with PHP.

Greg
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Indeed. You have the info on the server, and the means to easily use it to populate the field's value clause, so it's rather needless to send it all the way to the client and to write extra code to deal with it.

It's sort of like giving the postman a letter, an envelope, and a stamp and saying "Here, put this all together when you get to the destination address".
reply
    Bookmark Topic Watch Topic
  • New Topic