mull300
08-10-2006, 02:32 PM
Ok so i am trying to set up a simple form that you can add comments that when you submit the comments it adds the comments to the database and then pulls the comments from the database. The problem is that when i submit the data the results show without the spaces. "This is a test" comes out like this "Thisisatest".?!?
<script src="prototype.js" ></script>
<script>
function newComment()
{
var comment = $F('comment');
var subject= $F('subject');
var url = 'process_insert.asp';
var pars = 'comm=' + comment + '&sub=' + subject;
var myAjax = new Ajax.Request(
url,
{
method: 'post',
parameters: pars,
onComplete: showComments
});
}
function showComments(originalRequest)
{
var url = 'process_insert2.asp';
var pars = 'last_comment='+originalRequest.responseText;
var myAjax = new Ajax.Updater( 'existing_comments', url, { method: 'post', parameters: pars });
}
</script>
</head>
<body>
<div>
<form name="test" >
<input type="text" id="subject" size="20" /><br/>
<textarea id="comment" cols="30" rows="8"></textarea>
<input type="button" onClick="newComment()" value="Test"/>
</form>
<br>
<br><br>
<div id="existing_comments"></div>
process_insert.asp
<!--#include file="classes/global.asp"-->
<!--#include file="classes/functions.asp"-->
<!--#include file="var/session_variables.asp" -->
<%
comments=Request.form("comm")
subject=Request.form("sub")
call insert_ora("comments","id,case_number,type,comments,subject","1,97,'customer','"&comments&"','"&subject&"'")
%>
process_insert2.asp
<!--#include file="classes/global.asp"-->
<!--#include file="classes/functions.asp"-->
<!--#include file="var/session_variables.asp" -->
<html>
<body>
<%
response.write(Request.form("last_comment"))
call select_ora("*","comments","ORDER BY id ASC")
Do While Not ora_select.EOF
%>
<div><% Response.Write(ora_select("subject")) %></div>
<div><% Response.Write(ora_select("comments")) %></div>
<%
ora_select.moveNext
Loop
ora_select.close
%>
Hello
</body>
</html>
Can someone help this is my first time using ajax
<script src="prototype.js" ></script>
<script>
function newComment()
{
var comment = $F('comment');
var subject= $F('subject');
var url = 'process_insert.asp';
var pars = 'comm=' + comment + '&sub=' + subject;
var myAjax = new Ajax.Request(
url,
{
method: 'post',
parameters: pars,
onComplete: showComments
});
}
function showComments(originalRequest)
{
var url = 'process_insert2.asp';
var pars = 'last_comment='+originalRequest.responseText;
var myAjax = new Ajax.Updater( 'existing_comments', url, { method: 'post', parameters: pars });
}
</script>
</head>
<body>
<div>
<form name="test" >
<input type="text" id="subject" size="20" /><br/>
<textarea id="comment" cols="30" rows="8"></textarea>
<input type="button" onClick="newComment()" value="Test"/>
</form>
<br>
<br><br>
<div id="existing_comments"></div>
process_insert.asp
<!--#include file="classes/global.asp"-->
<!--#include file="classes/functions.asp"-->
<!--#include file="var/session_variables.asp" -->
<%
comments=Request.form("comm")
subject=Request.form("sub")
call insert_ora("comments","id,case_number,type,comments,subject","1,97,'customer','"&comments&"','"&subject&"'")
%>
process_insert2.asp
<!--#include file="classes/global.asp"-->
<!--#include file="classes/functions.asp"-->
<!--#include file="var/session_variables.asp" -->
<html>
<body>
<%
response.write(Request.form("last_comment"))
call select_ora("*","comments","ORDER BY id ASC")
Do While Not ora_select.EOF
%>
<div><% Response.Write(ora_select("subject")) %></div>
<div><% Response.Write(ora_select("comments")) %></div>
<%
ora_select.moveNext
Loop
ora_select.close
%>
Hello
</body>
</html>
Can someone help this is my first time using ajax