Click to See Complete Forum and Search --> : Please help with my Javascript


Dark Dragon
06-03-2003, 10:03 AM
I am in the midst of attempting to make my guestbook but it is obvious the script is incomplete so if someone could look at it and tell me what goes where, I'd be greatful.

Here is the code as follows, thanks :D

<html>
<head>
<title>Sign The Guestbook</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function MM_callJS(jsStr) { //v2.0
return eval(jsStr)
}
//-->
</script>
</head>
<body bgcolor="#000000" text="#00CCFF">
<div align="center">
<p><img src="imgs/gbook.gif" width="92" height="21"> </p>
<form name="form1" action="signgbook.htm">
</form>
<form name="form2" method="post" action="">
Name
<input type="text" name="entername" size="35">
</form>
<form name="form3" method="post" action="">
<p>E-Mail
<input type="text" name="enteremail" size="35">
</p>
<p>Web URL
<input type="text" name="enterurl" size="35">
</p>
<p>Message
<textarea name="entermessage" cols="75" rows="6"></textarea>
</p>
<p>
<input type="submit" name="submit" value="Submit" onClick="MM_callJS('processForm( )')">
<input type="reset" name="clear" value="Clear Form">
</p>
</form>
<p>&nbsp;</p>
</div>
</body>
</html>

Jona
06-03-2003, 10:07 AM
Well, try putting something like this in the code:


function Process(){
alert("Processing");
}


Jona

Dark Dragon
06-03-2003, 10:10 AM
Exactly where do I put it?

Thanks Jona

Jona
06-03-2003, 10:12 AM
Anywhere inside of the <script> and </script> tags.

Jona

Dark Dragon
06-03-2003, 10:18 AM
Thanks Jona...I appreciate it...(Whoo-hoo..I made bold text)

Jona
06-03-2003, 10:21 AM
You're welcome.

Whoo-hoo for the bold text,
Jona

Dark Dragon
06-03-2003, 10:25 AM
Hey!!!

Don't Mock me..I had to try and figure out these goofy tools here :D

Jona
06-03-2003, 10:28 AM
'Twas a joke, my friend.

Jona

Dark Dragon
06-03-2003, 10:38 AM
I know, I know... :D

One more question though..what should the script say in order to tell the host server to display the results on a separate page?

Jona
06-03-2003, 10:40 AM
That requires server-side code. JavaScript does not interact with the server.

Jona

Dark Dragon
06-03-2003, 10:43 AM
Ok..so if I understand this correctly...my basic script is fine yet I need to insert some sort of CGI in order to interact with the server. Am I correct somewhat?

P.S:
I like how you incorporated the name of your home state in the "location" bio

Jona
06-03-2003, 10:47 AM
You can use CGI, yes, but you wouldn't need JavaScript at all to use CGI. You'll need a form to process it. Something like...


<form action="post.cgi"><div>
Name: <input type="text" name="yourName"><br>
Email: <input type="text" name="yourEmail"><br>
Message: <textarea rows="10" cols="20" name="msg"></textarea>
</div></form>


I don't know too much CGI, so I couldn't really tell you enough to process this form..

Jona

Dark Dragon
06-03-2003, 10:50 AM
Hmmm..puzzling indeed. So since I used the form tags from Dreamweaver to make the page and incorporated the needed Javascript..I should be ok then, right?

Jona
06-03-2003, 10:55 AM
Yes, you should be fine. Until, that is, you click the "Submit" button (which I forgot to include in the form! :eek: ). Then the CGI processes it. That is where you have to have the CGI file process it.

Jona

Dark Dragon
06-03-2003, 11:01 AM
Wouldn't this do it?:

<input type="submit" name="submit" value="Submit" onClick="MM_callJS('processForm( )')">

I used the behaviors thingees in Dreamweaver as it instucted for Submit buttons...would that do it?

Jona
06-03-2003, 11:19 AM
You're not getting me here. You have to create a completely new file with CGI source code in it, and save it as a .cgi file. Then you have to set the form's action to the URL of that CGI file. The CGI processes it and outputs the information as you wish/program it to.

Jona

Dark Dragon
06-03-2003, 11:41 AM
You're not getting me here.

Yeah...I guess so..so I have to create a separate cgi file, right?..save it as cgi then set the actions...I think I got it then...maybe.

Jona
06-03-2003, 12:07 PM
You're getting me now! That's exactly what I meant.

Thanks for noticing my location idea. I had to come up with something that had an "X" in it... And an "A."

Jona

Dark Dragon
06-03-2003, 12:21 PM
I am gonna try that cgi script you showed me...I just put it into a blank document and save it as a cgi...it is all so alien to me though.

Thanks Jona!!! :D

Dark Dragon
06-03-2003, 12:25 PM
Opps..methinks that other code I spoke of isn't CGI...sorry.

About the CGI..can I just put it in a notepad or word document then save it as CGI then upload it?

Jona
06-03-2003, 12:26 PM
Wait a second. I didn't give you any CGI code. The form I posted was HTML. CGI looks a lot different. To print the results of the form fields on a new page in CGI... Ask in the CGI forum. I could figure it out and get back to you if you give me a couple of hours.. I'm kinda busy right now.

Jona

Jona
06-03-2003, 12:27 PM
Originally posted by Dark Dragon

About the CGI..can I just put it in a notepad or word document then save it as CGI then upload it?

Yes, you can open it in Notepad and type in the CGI code.

Dark Dragon
06-03-2003, 12:28 PM
Okay...laters then.

Jona
06-03-2003, 12:51 PM
I thought this might help ya: http://www.vortex-webdesign.com/help/forms_part_II.htm

Jona

Khalid Ali
06-03-2003, 01:06 PM
cripes....
what up with that eye poppppping color jona...:-)

Jona
06-03-2003, 01:12 PM
Sorry. lol Just playing around. ;)

Jona

Dark Dragon
06-03-2003, 01:25 PM
Thanks Jona..I will check it out too. I did ask at the CGI Forum but I kinda got the brush-off so I don't think I will get a answer that resembles helpfulness.

Yes...they gave me a title of a book to look into but the answer itself sounded like a thinly veiled brush-off.

Jona
06-03-2003, 01:30 PM
Well, I saw the post although I didn't reply.. In the CGI forum, it's assumed that you know a good deal of Web development. Just because the language of Perl (CGI's most used interpreter), is more difficult than PHP and probably more difficult than JSP. It's extremely (and I mean extremely) powerful.

Jona

Dark Dragon
06-03-2003, 01:37 PM
Huh...I see.

Jona
06-03-2003, 01:42 PM
If you have any further questions or anything like that, just ask. ;)

Jona

Dark Dragon
06-03-2003, 01:46 PM
Thanks..I will.

I know that to many I probably appear like a real numbskull but my business colleges idea of advanced web design was...well...I just don't know what they were thinking...maybe they felt HTML was as far as it goes or something :rolleyes: