Click to See Complete Forum and Search --> : Send but no recieve.


Zero-x252
08-10-2003, 08:36 PM
Ok you can use the below code to send messages but the other side but you dont recieve what can fix this?

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
<!--
function displayText(str) {
var message = str
var name = document.name.user.value
var disp = '<br>[' + name + ']_____:___________' + message
var show = document.getElementById('displayArea').innerHTML + disp;
document.getElementById('displayArea').innerHTML = show
document.form1.text1.value="";
window.scrollBy(0, 10000);
return false;
}
//-->
</script>
<style type="text/css">
<!--
#displayArea, body {width: 100%; margin:0px 0px 0px 0px; color: #FFFFFF; background: #000000;}
.2 { border: medium double #FFFFFF; background: #000000; color: #FFFFFF}
-->
</style>
</head>
<body>
<br /><br />
<div id="displayArea" class="2"></div>
<form name="form1" onSubmit="return displayText(this.text1.value);">
<input class="2" type="text" name="text1" maxlength="55" size="107" />
</form>
<form name="name" onSubmit="return false">
<input class="2"type="text" name="user" maxlength="10" size="107" value="name" />
</form>
</body>
</html>

Phil Karras
08-11-2003, 11:47 AM
I can't really see what you're talking about, however I'll point out that using:

<form name="form1" onSubmit="return displayText(this.text1.value);">

is probably wrong. All it is doing is returning the output of displayText back to this file, it doesn't "send" it anywhere.

TO send something to a server you use:

<form action='MyProgram.cgi' name="form1" onSubmit="return displayText(this.text1.value);">

I named the program that receives the sending as MyProgram.cgi, it could be a .php, or .asp, or .jsp, etc whatever server-side language you have available.

Now, one the server-side script has the data it can send something back to the client.

Is that what you're talking about sending & receiving?

Also, when you return something to the <form ...> tag it needs to be either a 0 or a 1, false or true so the <form...> tag knows to either NOT send anything to the server or yes send something. You do not return text or anything else to the <form...> tag.


Your function seems to ALWAYS return a false, which means DON'T send anything to the server. So, No Sennding is being done. If no sending is being done no receiving can be done either.