This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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.
[ February 03, 2008: Message edited by: Greg Pugh ] [ February 03, 2008: Message edited by: Greg Pugh ]
Where are these list of dates: In the same window? In a pop up window?
pop up window
Joined: Feb 03, 2008
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?
Your help confirming that I'm on the right track saves me much time and worry. I appreciate it.
[ February 04, 2008: Message edited by: Greg Pugh ] [ February 04, 2008: Message edited by: Greg Pugh ]
Joined: Nov 08, 2001
If you are navigating to a new page in the same window. You need to pass the data in the querystring.
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 ]
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.
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'
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.
Joined: Nov 08, 2001
well if there is no form name, you can reference it with
Yeah, element names can not have spaces. Should be an underscore or smash it together.
Joined: Feb 03, 2008
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:
Thanks for any thoughts,
Joined: Feb 03, 2008
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.
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".