This topic is locked

Concatinate multiple textarea text

3/12/2007 4:47:03 PM
ASPRunnerPro General questions
Z
zion4ever author

Hi people,
I am developing a website that allows submission of troubletickets online.

I'm trying to use asprunner for this, but not sure it can do the job.
I have a few fields that are read only (like cust.nr and ticketnr etc)

Now there are 2 fields -History and communication.
First of all I would like the history field to be read only. So users may edit the communication field by entering their problem. the history field however should be left unchanged!
Now when I make the history field read only, it only allows one single line of info.

Second, when using the following code, the info from the communication field is concatinated to the history field, however it does generate an error:"
<<< Record was NOT edited >>>
Multiple-step operation generated errors. Check each status value.
However it does properly add the text from the comm field to the history text. If I logout from the webpage, only the first line of text is saved to the db.

The mysql field is set to longtext for both textareas.
I am using the following code:
Function BeforeEdit(dict, where)
' Parameters:

' dict - Scripting.Dictionary object.

' Each field on the Edit form represented as 'Field name'-'Field value' pair

' where - string with WHERE clause pointing to record to be edited
'** Custom code ****

' put your custom code here
Dim NewCom

NewCom = Dict("Communicatieveld")
Dim ConcatCom

ConcatCom = Dict("Historie") & vbCrLf & vbCrLf & now & vbCrLf & NewCom
Dict("Historie") = ConcatCom
BeforeEdit = True
' set BeforeEdit to True if you like to proceed with editing this record

' set it to False in other case
End Function
Can someone please help me out?
hans

holland

J
Jane 3/13/2007

Hans,
you can't use dict("FieldName") variable on the Before record updated event if FieldName is readonly on the Edit page.

I recommend you to use following code:

Function BeforeEdit(dict, where)

'select History field from database

str = "select * from " & strTableName & " where " & where

Set rsTemp = server.CreateObject("ADODB.Recordset")

rsTemp.open str, dbConnection
Dim NewCom

NewCom = Dict("Communicatieveld")

Dim ConcatCom

ConcatCom = rsTemp("Historie") & vbCrLf & vbCrLf & now & vbCrLf & NewCom
rsTemp.Close : set rsTemp = Nothing
'update History field in the database

strUpdate = "update " & strTableName & " set Historie='" & ConcatCom & "' where " & where

dbConnection.Execute strUpdate
BeforeEdit = True
End Function

Z
zion4ever author 3/13/2007

Hans,

you can't use dict("FieldName") variable on the Before record updated event if FieldName is readonly on the Edit page.

I recommend you to use following code:


Jane,
Thank you for your reply.

The readonly field "Historie" now saves multiple lines.

However, it doesn't add the text from the "communicatiefield" -this is the field the users uses to provide input regarding their problem - to the historie field.
Plz point me in the direction here. Your code does use the newcom variable to concatinate the dict("communicatieveld") to the historie contents. So I don't understand why this doesn't work.

Z
zion4ever author 3/13/2007

Hans,

you can't use dict("FieldName") variable on the Before record updated event if FieldName is readonly on the Edit page.

I recommend you to use following code:


Plz see my previous question about the communicatieveld field not joining the historie field.

It works well now. However after submitting a edit, the sonds time it works well, the third also, but the fourth generates:
<<< Record was NOT edited >>>
Multiple-step operation generated errors. Check each status value.
Still everything is added as it is supposed to.

Any ideas, or maybe an error handler like in VB - on error resume next or something?
TIA

Z
zion4ever author 3/13/2007

Okay,
for those in a similar situation.

I don't know why this is, but somehow by making the "communicatieveld" empty on BEFORE EDIT, it seems to work.
So I just added to the beforeEdit = true:
Dict("Communicatieveld") = ""
Thnx for all help

J
Jane 3/13/2007

Hans,
this is often a datatype problem. Make sure you are passing valid datatypes to whatever is going on in the database.

Make sure that all VARCHAR lengths are adhered to.