Form results as HTML
- Started
- Last post
- 9 Responses
- mg33
Maybe someone has experience with this.
I have a form that sends by ASP to an Access db. The results are then displayed in an interactive phone list where each person's name can be clicked for more details.
There is a bio section that I would prefer to have formatted as HTML, however it is transmitting my code from the entry form as charecters, so a line break tag is shown as .Anything I'm missing here that will make this work?
Thanks.
- SteveJobs0
"break tag is shown as ."
huh?
where is the data coming from that you are displaying? a form or database? if form, what contains the data - hidden field, textarea, textbox, etc? how are you sending the data - querystring, http headers?
posting a text file containing some code might help as well.
- mg330
sorry, it didn't even show it.
I mean't the break tag shows up as the greater than and less than symbol and the br.
Viewing the results (which are in an ASP page) the source shows it asDisplayed data comes from an Access DB.
Submission form > Access DB > Results in ASP
Everything is ASP with HTML templates linked to the ASP and controlling the look of the page. It looks like it sends the submission form by Javascript.
- UndoUndo0
you should need to format content from a textfield in a form with html.
line breaks will be kept as whitespace unless you specify otherwise. I'm not sure with asp but in php you can use the built in func htmlspecialchars() to remove anything like a line break and stop anyone executing code from with forms
- SteveJobs0
i haven't had my coffee yet, so i'm slow this morning, but why are 'break tags' being sent from the access database to the asp page? this doesn't make sense to me. if you open the table and look at the data, do you see html in the text? if so, this is not right.
your code minus formatting should look something like this:
while not o.eof
response.write o.fields("fname").value & "[br]"
o.movenext
wendand of course switch out the brackets in "[br]"
- mg330
Steve,
I guess a better way of describing it is this:
I want to enter text with HTML for formatting purposes (nothing fancy, just bold text, line breaks)
send it to the DB and have the results show up in the ASP page with formatting intact.Looking at the tables in Access, the break tag is displayed as greater than br less than.
So the problem must be in how the results page is interpreting the Access fields?
- SteveJobs0
ok, don't put your formatting in the database, write it on the fly in the asp page like so:
response.write "[b]" & o.fields("fname").value & "[/b][br]"
- mg330
Steve,
The only catch is that this is one field. I understand what you're saying about the response.write, but the results are all displayed within one table cell.
I need to have:
About: info info info
Hobbies: info info info
Department: infoor something like that with the about, hobbies, department, etc. bold and starting on a new line.
If I could get the output to recognize the tags entered in the submission form, all would be okay I think.
Thanks again for your help :)
- weestu0
i think Server.HTMLEncode might be what you need to use: http://tinyurl.com/832e5
- mg330
Just filling you guys in on the solution to my problem.
I looked into the Server.HTMLEncode extensively, even found people having the same problem as me with the same ASP application.
The existance of Server.HTMLEncode in the file is what causes the problem. It was PREVENTING the ASP page from pulling the data from Access and displaying HTML formatting.
Simply taking that out for the section I needed to be formatted solved it. There was a variable that controlled it, and it was this:SetVar "address", ToHTML(fldaddress)
Simply taking that out and changing to:
SetVar "address", fldaddresssolved the problem.
Much thanks for your help, you pointed me in the right direction.