Vbcrlf At End Of Textarea Comments Leads To Problems
An important thing to mention here is that when this data goes into my database table i'm using the UPDATE function to modify pre-existing records in the database.
The form that contains my textarea also populates the textarea with the current data from the database so when I submit data, when the page refreshes I should see, in the textarea, the data that I just submitted.
Another things worth mentioning is that when I UPDATE this information in the database, the content from the textarea goes through a instances of the replace() function. There is one in particular that I need but is causing problems:
when the data from the textarea contains a line break I want that to become a break tag in the database. This works well EXCEPT for a line break that seems to always exist at the end of the text in the textarea when I submit my form to be processed. This trailing line break exists regardless of any attempts. If I have: Code:
how to dispaly text from a text area on a page as page copy (using the replace function)
How do I display this text inside another textarea, holding formatting? All variations of 'what I thought would work' do not.
I am using the following function:
Function DisplayMemo(theText) DisplayMemo = "" on error resume next DisplayMemo = CStr(theText) if (len(DisplayMemo) > 0) Then DisplayMemo = Replace(DisplayMemo, vbCrLf, "<br>", 1, -1, 1) end if End Function
NOTE: getInfo(0) is a variable holding my value. Yes the value is there. It is showing the text I want, however the <br>'s are rendered inside the text area?
I am using asp and mysql. I have a form that sends an e-mail and also the info is saved in a db so I can log how many messages went to whom. My problem is that I have a comment field that is a textarea input and I got this message: Microsoft OLE DB Provider for ODBC Drivers error '80040e09'
[TCX][MyODBC]You have an error in your SQL syntax near 'i" This should go to Paul.","4","29","2002","10:08:24 AM")' at line 1
/shared/products/contact.inc.asp, line 292
I had sent successfully numerous times today before this, but in this message I had double-quotes - "i". I heard somewhere that mysql will barf on double quotes.
How can I modify them to single quotes before they go to the db? Again,the check would convert any double quotes to single quotes in a textarea input.
I have quite a large website that I am trying to add a new feature to. Every once in a while an article will be posted that I would like people to be able to comment on. In this way - it is sort of like a blog - except I don't need any other features. However, I do need an admin page just to be able to delete any comments if needed.
I have done some searching for some code examples but I just get a lot of full licensed blog apps. If anyone knows of any sample code - or better yet, tutorials that I could follow, that would be greatly appreciated.
I have an ASP page with a <textarea> on it that is posting the contents of the <textarea> into an Access database Memo field. When the form on the page is processed, I use the following code before putting the information into the database:
var mytextarea = Request("mytextarea")+"";
mytextarea = mytextarea.replace("'", "''");
This should deal with the single quotes in the text before the INSERT query The problem is that it only works if mytextarea has one quote. If there are more than one quote in mytextarea, I receive the following error:
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression ''Isn''t it funny this doesn't work'
Anyone know why it is not replacing all instances of single quotes in the string?
I want to know what's the convenient way to comment out a block in ASP pages? I read a book, and I thought we can use /** */ to comment out the VBScript in ASP page, but it yields run time error.
All I know is to use ' but this is very slow if I want to comment out a block?
im starting work on a new site and would like it to be a ASP site. I want users to be able to go onto a page of my site and post there own comments and then have those comments permantly stay there on that page. how I can do this?
The use of includes in ASP is good where code is re-used in multiple forms,etc. (doh, ... that's what they _are_ for ! ). If I have something like: Code:
I get some comments on a function I wrote? I posted on PlanetSourceCode so I could see what people think, but nobody seems interested, although I know this is a huge time-saver. It generates an update query for you based on the results of a form. It takes care of check whether or not the field is valid, is a string or numeric, etc. Code:
Is there something that I need on my computer in order for vbCrLf to work? Anytime I include that in my ASP code it never creates a line break... it just ignores it. I have to change it to "<br>" Am I doing something wrong?
It works fine but when I use this same code to get x characters plus display it using VBCRLF, with the <br> with writing the code :
<%=Replace LEFT (Recordset1.Fields.Item("Detail").Value,VbCrLf,"<br><br>",50)%>
it gives me error so please can you tell me how can i trim the characaters and at the same time use VBCRLF. why does this above code with LEFT + vbCrLF doesn't work.
I'm trying to read in image data using the filesystemobject. I am able to read the comments field for all file types it seems, except the ones I want, .gif .jpg and .bmp.
Is it possible to do this?! If so what might I need to do? Code:
I am writing a small database utility to catalog all of my favorite ASM/JS/VBS functions and scripts on an asp page. Everything is going smoothly except for one thing that I can't quite seem to think my way around.
I am using a <textarea> to display the code but some of my scripts have <textarea> tags in them and when the </textarea> tag is entered, it closes my <textarea> and the rest of the code ends up outside of the textarea.
Example: (the code after the middle </textarea> show up outside of the textarea box)
When users fill out my text area field, there is a chance that there will be no line feeds or cariage returns or spaces and just one really long word.
THIS CAUSES A MAJOR PROBLEM! What I am trying to do is force a vbCrLf if a string is long than 80 characters in a row. So if a string is a total of 500 characters with no line feeds, spaces, or returns, I want to force a vbCrLf every 80 characters so that is doesn't overflow my preview text field on the next page.
Any suggestions on how the algorithm would be for this in VBscript ASP?
I am able to populate the contents of my textares with employees. However when I view it in the browser (IE 6.0), then I see that the 1st employee is aligned towards the right.
Like this: Code: Emp1 Emp2 Emp3 Emp4 Emp5
How can I ensure that my alignment is is proper? Code:
I made a simple <textarea> , but the problem is, everytime I want to press Enter to break row , I gotta put <BR> .. can I do something that the user can type freely and the ASP will insert <BR> where needed?
I've written several scenarios where the end user needs to enter data into a textarea (descriptions, messges etc) which becomes part of a form. End users often put apostrophe's and carrige returns in the textarea... however, when the code i write is submitted to the database, it generates an sql command from the page that sent the action.
Now, when strange people put carrige returns, it stuffs up the string and therefore produces an error, and to make matters worse if it did recognise a carrige return, it wouldn't be displayed on HTML output. Apostrophes are even worse - they signify the end of a variable in the SQL sentance Can anyone help me and figure out a new way of writing to the DB?
I've got a page on a website I'm developing that contains a textarea. The textarea will allow users of the site to enter a description of an item.
When they submit the form that contains the textarea, the textarea and other form elements data are stored in a database. So far so good.
My problem concerns carriage returns, new lines, line feeds or whatever else you want to call them :-)
I want them preserved, so when the user wants to edit the description of the item, the format of the description is displayed exaclty as it was entered.
The problem is that HTML renders the carriage returns as white space, so when the database is read and the textarea populated with the description field, the carriage returns are lost.
I have tried the ASP REPLACE function to replace carriage returns with <br>, but the code below actually displays all the <br>'s.
I played around with different combinations of chr(13) and vbcrlf and I managed to get the textarea to display the description as it was entered with carriage returns, but upon further testing and editing of the description, because of the REPLACE function, the number of carriage returns was doubling each time!
i have 2 tables one table stores the information for the prof and second table stores information for the subject he teaches so first table deptprof has the id,name,email for the professor
so i get his last name and email which is working second table design is name is deptlist fields are
deptautoid deptid subjectname desc
so one professor might be teaching 3 subjects
so the records in table are
1001 3 maths maths subject is boring
1002 3 science science is good
1003 3 sports make some time for it
so now this page lets the professor update the subject and its desc
so what i do is fill up the subjects and desc he is currently assigned to and then he can change the subjects and desc
subjects have a checkbox and desc has a textarea
what happens is for example a professor has 3 subjects he is teaching now
so 3 checkboxes are selected and all the desc for them are displayed in the textarea
but now the professor decides he wants to teach 4 subjects so he selects the 4th subject checkbox and doesnt enter the desc i want to fire the alert
but it doesnt fire the alert
second way prof is teaching 3 subjects 3 checkboxes are selected and 3 textarea are filled
professor decides to delete desc in one of them and hits submit i want to fire an alert saying he forget desc but it doesnt fire so whenver desc is deleted from the textarea and checkbox for it is selected i want to fire an alert
can someone tell me whats wrong with the code
thanks,
todd
Code:
<%
getid=trim(request.form("id"))
sqlstr = "SELECT *FROM deptprof WHERE ID = '" & getid & "'" Set rsdept = Conn.Execute(sqlstr)
sqldeptdetails = "SELECT *FROM deptlist WHERE deptid = '" & getid & "'" Set rsDetails = Conn.Execute(sqldeptdetails)
%>
<head> <title>Dept List</title> <script type="text/javascript"> <!-- function formCheck(formobj) { var fieldRequired = Array('LName', 'Email'); var fieldDescription = Array('Last Name', 'Email');
var alertMsg = "You can't submit the form until ALL the mandatory fields have been filled out. "; alertMsg += '_________________________________________________ ___
' alertMsg += "Please complete the following fields, then press 'Update dept':
"; var c = 0; for (var i = 0; i < fieldRequired.length; i++) { var obj = formobj.elements[fieldRequired[i]]; document.getElementById(fieldRequired[i]).style.backgroundColor = '#' +'ffffff'; if (obj) { switch(obj.type) { case 'select': if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == '') { alertMsg += ' - ' + fieldDescription[i] + ' '; document.getElementById(fieldRequired[i]).style.backgroundColor = '#' + 'f8e563'; c++; } break; case 'text': case 'textarea': if (obj.value == '' || obj.value == null) { alertMsg += ' - ' + fieldDescription[i] + ' '; document.getElementById(fieldRequired[i]).style.backgroundColor = '#' + 'f8e563'; c++; } break; default: if (obj.value == '' || obj.value == null) { alertMsg += ' - ' + fieldDescription[i] + ' '; document.getElementById(fieldRequired[i]).style.backgroudColor = '#' + 'f8e563'; c++; } } } } alertMsg += ' These fields have been highlighted for your attention.'; if (c == 0) {
var strGroupName="rad1"; var checkedCount=0; for (var i=0; i<document.frm1.elements[strGroupName].length; i++) {
var curBox=document.frm1.elements[strGroupName][i];
if (curBox.checked) {
if (document.frm1.elements["txt"+(i+1)].value=='') {
alertMsg += "Please complete the following fields, then press 'update dept':
"; alertMsg += "You have not entered the value for the "+(i+1)+" Specify desc
<tr class="evenrow"> <td>1.</td> <td><input type="checkbox" name="rad1" value="Maths" <% do while not rs.eof if rsDetails("subjectname") ="Maths" then Response.Write "checked" end if rsDetails.movenext loop rsDetails.movefirst %>
> Maths</td>
<td><textarea name="txt1" id="txt1" rows="2" cols="35"> <% Dim rs1,sqlr1,raexp1 raexp1="Maths"
sqlr1 = "SELECT desc FROM deptlist WHERE deptid = '" & getid & "' and subjectname='" & raexp1 & "'" Set rs1= Conn.Execute(sqlr1)
I am trying to display data pulled from a sql db in a text area. The field in the db is of type ntext. I am printing the data using the following code.....
Is there a simple way to get the content of my textarea not encoded !? My text area has comments in it and right now, I have to replace all encoded characters...
I'm looking for some basic end user textarea formatting, similar to the formatting available when messages are created in this forum, bt even more basic.
I really would like let the user add hyperlinks and to add bolded text without knowing the html tags for these. Any suggestions on where to look for this. Ideally something that would work with all browsers (i.e. including Opera).
I need to create a form with a textarea on an ASP page that, when opened, fills the textarea with the current contents of a field in an Access database, and each time the form is submitted, appends any new text added to the existing text in the database field. I can do this, but the text runs together when it fills the text area. Example: Entry 1
Entry 2
comes back as
Entry 1Entry 2
Any suggestions on how I can maintain line feeds when I pull the appended field back from the database.
I am using TEXTAREA as input. While entering texts sometimes I am creating paragraph and save them .But when I retrieve from database it comes without paragraph.
Is there any way we can create paragraph in TEXTAREA?
I know this is not a core .asp issue, but I'll try anyway. I've used the TEXTAREA element for a while, but as you know it's limited when it comes to formating part of the text inside a TEXTAREA.Does anyone have expirience using other text cointainer objects (Java/ActiveX), which is easy to use and easy to read values from when sending a form to a procedure .asp page?
I have this textarea in my form that is not displaying data. BUT when you look at the source you can see the text in the 'value'.here is the code:Code: