Forums
This topic is locked
That linechanging thing again...
Posted 11 Jun 2002 23:16:30
1
has voted
11 Jun 2002 23:16:30 Kristian Waagsboe posted:
Server Type: ASP JavaScriptHere's the source code of an insertpage which inserts linebrakes when enter is pushed in a textarea. Please check the bolded text and see whether i placed it right or not. I'll be very grateful
Here's my code, works ok but won't include those nifty linebrakes...
// create the sql insert statement
var MM_tableValues = "", MM_dbValues = "";
for (var i=0; i+1 < MM_fields.length; i+=2) {
var formVal = MM_fields[i+1];
var MM_typesArray = MM_columns[i+1].split(","
var delim = (MM_typesArray[0] != "none" ? MM_typesArray[0] : "";
var altVal = (MM_typesArray[1] != "none" ? MM_typesArray[1] : "";
var emptyVal = (MM_typesArray[2] != "none" ? MM_typesArray[2] : "";
if (formVal == "" || formVal == "undefined" {
formVal = emptyVal;
} else {
if (altVal != "" {
formVal = altVal;
} else if (delim == "'" { // escape quotes
formVal = "'" + formVal.replace(/'/g,"''" + "'";
} else {
formVal = delim + formVal + delim;
<b>FormVal = Replace(FormVal,vbCrLf,"<br>" </b>
}
}
MM_tableValues += ((i != 0) ? "," : "" + MM_columns[i];
MM_dbValues += ((i != 0) ? "," : "" + formVal;
}
Replies
Replied 12 Jun 2002 01:09:12
12 Jun 2002 01:09:12 aegis kleais replied:
Well, I'm just as new to ASP and all, but if you use javascript, aren't the variables case-sensetive?
ie,
FormVal = Replace(FormVal,vbcrlf,"<br>"
wouldn't exist because you've never referenced FormVal before (You've just referenced formval - in lowercase)
ie,
FormVal = Replace(FormVal,vbcrlf,"<br>"
wouldn't exist because you've never referenced FormVal before (You've just referenced formval - in lowercase)
Replied 12 Jun 2002 15:19:23
12 Jun 2002 15:19:23 Kristian Waagsboe replied:
Hmmm, thanks for the reply...
I did what you told me to, still doesen't work... I was thinking that perhaps this bolded line is placed wrong, and that it should be another place... Anybody who knows?
(update)
Do I have to define vbcrlf? In case, how and where do I do that??
Edited by - Kr]st[an on 12 Jun 2002 15:28:22
I did what you told me to, still doesen't work... I was thinking that perhaps this bolded line is placed wrong, and that it should be another place... Anybody who knows?
(update)
Do I have to define vbcrlf? In case, how and where do I do that??
Edited by - Kr]st[an on 12 Jun 2002 15:28:22
Replied 12 Jun 2002 15:50:31
12 Jun 2002 15:50:31 Kristian Waagsboe replied:
YES! Finally decided to run a search for vbclrf in the forum and then I found an interresting tech note from macromedia which presented a solution to my f**** troubles. Thanks for replying though aegiskleais.