/    Sign up×
Community /Pin to ProfileBookmark

Need simple tweak for free script

I downloaded a javascript for an email form. It appears to work except for one irritating little thing: I can’t edit the default text in the name field to say “Name”. It only displays as “Null” no matter what I do.

I’m working on the web page within Front Page. I copy/pasted the code without altering it, and shot it over to the server. The word “Null” displayed in the Name field.

So I made a change to that field to set the default text, and displayed it in Preview mode within Front Page. It looks fine: the field says “Name”. Then I sent it over to the server, where you can view it at [url]www.bookandquill.com/testcontrol.htm.[/url] The word “Null” is back.

I would be satisified if NOTHING displayed in that field – my objective is really just to remove the word “Null”.

I am not a programmer, so I’m reluctant to alter the code. I identified several places where the word “Null’ appears within the code, but I don’t know which one is the culprit in this instance. Could someone please help?

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisJan 23.2003 — [i]Originally posted by nellgavin [/i]

[B]www.bookandquill.com/testcontrol.htm.[/B][/QUOTE]

Dead link...
Copy linkTweet thisAlerts:
@JonaJan 23.2003 — Yea, the link doesn't work. I think it would make it [i]easier[/i] if you at least posted the code ?
Copy linkTweet thisAlerts:
@nellgavinauthorJan 23.2003 — The message board included the period at the end of the sentence in the link, and since I couldn't see the link as "active" while I was typing, I didn't catch it. The actual URL is www.bookandquill.com/testcontrol htm WITHOUT a period. (If you see this sort of thing again on the board, you can copy the link, paste it into the address field, then delete the text that is obviously screwing it up.)

Since you asked for the code, I'm pasting it below. It's a script you can download from this site.

Thanks!


<html>

<head><script LANGUAGE="JavaScript">

<!-- This script and many more are available online from -->

<!-- The JavaScript Source!! http://javascriptsource.com -->

<!-- Begin

function getCookie(name){

var cname = name + "=";


var dc = document.cookie;


if (dc.length > 0) {


begin = dc.indexOf(cname);


if (begin != -1) {


begin += cname.length;


end = dc.indexOf(";", begin);

if (end == -1) end = dc.length;

return unescape(dc.substring(begin, end));

}

}

return null;

}

function setCookie(name, value, expires) {

document.cookie = name + "=" + escape(value) +

((expires != null) ? "; expires=" + expires.toGMTString() : "")

+ "; path=/";

}

function setName() {

var expdate = new Date ();

expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 365));

var prompt=i = document.Mail.name.value;

setCookie("name", i, expdate);

}

function getName() {

if(getCookie("name") != null) {

document.Mail.Name.value = getCookie("emailname");

}

}

function getInfo() {

var now= new Date();

document.Mail.Info.value = "Browser: " + navigator.userAgent;

document.Mail.Info.value += "Date:" + now;

}

function checkMultiple() {

if (getCookie("emailsent") == 'true') return true;

else return false;

}

function process() {

setCookie("emailsent", "true");

with (document.Mail) {

if (Subject.selectedIndex == 1) action = "mailto:[email protected]?subject=TJS - Comment";

else if (Subject.selectedIndex == 2) action = "mailto:[email protected]?subject=TJS - Question";

else if (Subject.selectedIndex == 3) action = "mailto:[email protected]?subject=TJS - Suggestion";

else if (Subject.selectedIndex == 4) action = "mailto:[email protected]?subject=TJS - Broken Link";

else action = "mailto:[email protected]?subject=TJS - Other";

}

}

function formCheck() {

var passed = false;

with (document.Mail) {

if (Subject.selectedIndex == 0) {

alert("Please pick a subject.");

Subject.focus();

}

else if (Name.value == "") {

alert("Please inlcude your name.");

Name.focus();

}

else if (checkMultiple()) {

if (confirm("You just sent an e-mail from this form, are you sure you want to send another?")) {

process();

passed = true;

}

}

else {

process();

passed = true;

}

}

return passed;

}

// End -->

</script>

<title>JavaFILE</title>

<base target="leftframe">

</head>

<body BGCOLOR="#ffffff" link="#CC0033" vlink="#333399" alink="#FF0000" <!--content start-->

<p align="center"><img src="http://www.javafile.com/images/banner.GIF"

alt="banner.GIF (2826 bytes)"></p>

<table WIDTH="96%" BORDER="0" CELLSPACING="5" CELLPADDING="5">

<tr>

<td WIDTH="100%">Without question, this is the best javascript email form I have ever

seen. It sets cookies, checks form completion of all fields, and even knows if someone has

already sent a message with the form...JavaFILE gives this one 4936.7 stars! ?<font

FACE="ARIEL,HELVETICA" SIZE="-1"><p align="center"></font>Author: <a

href="http://javascriptsource.com">TheJavaScriptSource</a>&nbsp;&nbsp; <a

href="http://www.javafile.com/javascripts/forms/emailform5.zip">Download the Script</a><font

FACE="ARIEL,HELVETICA" SIZE="-1"></p>

<p align="center"><font FACE="Times" SIZE="3">Any thing you would like to tell us? Any

comments, suggestions, or questions? If you are using Internet Explorer or would rather

mail directly, then click <a HREF="mailto:[email protected]?subject=TJS - Mail">here</a>.

<br>

</p>

<form NAME="Mail" ACTION="mailto:[email protected]?subject=TJS - Form"

METHOD="POST" ENCTYPE="text/plain" onSubmit="return formCheck();">

<input type="hidden" name="Info" value><table BORDER="0" CELLPADDING="10" CELLSPACING="0">

<tr>

<td>Name: <input TYPE="text" NAME="Name" onChange="setName()" size="20"> </td>

<td ALIGN="RIGHT">Subject: <select NAME="Subject" size="1">

<option SELECT>Please Select A Subject</option>

<option>1. Comment</option>

<option>2. Question</option>

<option>3. Suggestion</option>

<option>4. Broken Link</option>

<option>5. None of the above</option>

</select> </td>

</tr>

<tr>

<td COLSPAN="2">Comments, questions, suggestions, broken links, anything!! : <br>

<br>

<textarea NAME="Comments, Suggestions" COLS="50" ROWS="6">

</textarea> </td>

</tr>

</table>

<div align="center"><center><table>

<tr>

<td align="center"><input TYPE="submit" VALUE="Send"> <script LANGUAGE="JavaScript">

<!-- Begin

getInfo();

getName();

// End -->

</script></font></font></td>

</tr>

</table>

</center></div>

</form>

</td>

</tr>

</table>

<!--content stop-->

</body>

</html>
Copy linkTweet thisAlerts:
@nellgavinauthorJan 23.2003 — That time it didn't include the period BEFORE the HTM. (Sorry. typing too fast...)

Here is the link: www.bookandquill.com/testcontrol.htm
Copy linkTweet thisAlerts:
@JonaJan 23.2003 — It works on IE6. That is what I use. It says, "Name."
Copy linkTweet thisAlerts:
@nellgavinauthorJan 23.2003 — I'm using IE5.50, and it still says Null. I guess this calls for an upgrade.

But now that I know it doesn't display correctly on IE5.50, is there any way to write the code to address this?

Thanks!
Copy linkTweet thisAlerts:
@JonaJan 23.2003 — Eh, there's definitely a way. I just have to think a while.. I have to go now, but if someone else doens't answer your question, I'll be back on tonight. Cya, sorry ?
×

Success!

Help @nellgavin spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...