Custom Fields text format |
Post Reply |
Author | ||
mattprice
Senior Member Joined: 03-June-2007 Location: United Kingdom Status: Offline Points: 0 |
Post Options
Thanks(0)
Posted: 03-June-2007 at 3:29am |
|
Hello, Sorry, only my second post and I am asking questions rather than helping to answer them (I will redeem myself as I get to grips with this program) I have a problem with the display of text in a custom field. I am using a Text Area custom field to capture a customers wording details. The carriage returns that the customer enters are important to the layout but are not retained when the text is subsquently being pulled from the database. Eg :- When the customer enters the text :-
it translates to the following truncated text when pulled from the database in the subsequent viewbasket and checkout screens and in the backend after order completion
Does anybody know how to retain these line breaks when the custom field is redisplayed. Many Thanks Matt |
||
mattprice
Senior Member Joined: 03-June-2007 Location: United Kingdom Status: Offline Points: 0 |
Post Options
Thanks(0)
|
|
I havent solved my problem but I have just realised that the order confirmation sent to a customer does have these line breaks in place so that the text is formatted correctly. Also, when I look at the order in the back the text is not formatted correctly at first but if I click on the edit link to edit the custom field as an administrator and save it again (without actually making any changes) the text miraculously reformats itself as it was originally entered by the customer. I guess the line breaks are correctly being held in the database. Therefore, my only real issue is how the text is being formatted in the view basket and checkout screens which would confuse a customer in thinking that their text has been all wrapped together when in actual fact it has been captured correctly. If anyone has any ideas I would be most grateful. Many Thanks Matt |
||
thedeacon
Groupie Joined: 09-July-2006 Status: Offline Points: 0 |
Post Options
Thanks(0)
|
|
Hi Matt, Have them indicate line breaks with "<br>" (without the quotes) and you should be all good :) |
||
thedeacon
Groupie Joined: 09-July-2006 Status: Offline Points: 0 |
Post Options
Thanks(0)
|
|
Whoops! I was looking at the wrong thing there. Give me a moment and ignore my last post.
|
||
thedeacon
Groupie Joined: 09-July-2006 Status: Offline Points: 0 |
Post Options
Thanks(0)
|
|
Hi again, I'll have another look at it a bit later. What happens is that all formatting and HTML code is removed from the text on the shopping cart summary. My guess as to why follows: 1) To prevent exploits. If all code and formatting weren't removed, an unscrupulous individual could technically throw in a bunch of code in that text field to crash your server or a script that would download the entire contents of your database and then delete it off your server. 2) To keep the page's appearance from becoming altered. If the HTML code and formatting were left in, I could add in a tag that says something like <font style="font-size: 3000px"> and without the corresponding </font> tag to close it out, the rest of your page would be in humungous text. Technically, the page could be altered to allow certain tags and even force them to close out the tags at the end of the input field, but there's a bit of work involved in that. You could always put in something like "Unformatted preview text - text will display properly in your confirmation email" |
||
mattprice
Senior Member Joined: 03-June-2007 Location: United Kingdom Status: Offline Points: 0 |
Post Options
Thanks(0)
|
|
I have had a dig a bit further because I am curious as to why if I edit the custom field text on an order in admin I can restore the correct html display with the <br> returns in place simply by clicking on the edit link from within an order and updating the field entry without changing any text or formatting. This edit custom field link when viewing an order in the backend pulls up a customInput_popup.asp file that has a routine to '// Repair HTML for the Line Return. This routine seems to replace <BR> with <BR> in a number of places. My problem now is figuring out how to get this "Html repair" when the custom field is displayed on the viewcart.asp screen. :-(
Edited by mattprice - 03-June-2007 at 8:07am |
||
thedeacon
Groupie Joined: 09-July-2006 Status: Offline Points: 0 |
Post Options
Thanks(0)
|
|
I was a bit engaged today, but I took a quick look and it's not jumping out at me. I would have figured there'd be a "ClearHTMLTags" command and there's a chance there is somewhere, just not on the viewcart.asp page. At the beginning of viewcart.asp, it includes a number of files (<!--#include file="../includes/settings.asp"--> So the command is most likely somewhere in one of those files and can be edited to allow certain html tags. I keep raising mental red flags though whenever I think about allowing arbitrary code in an input text field though :p I'm sure I can find the code, but time is a bit of an issue at the moment. I'll check back in though! |
||
mattprice
Senior Member Joined: 03-June-2007 Location: United Kingdom Status: Offline Points: 0 |
Post Options
Thanks(0)
|
|
No problem Richard, I really appreciate your help. After reading the following short extract on texareas at http://www.learnasp.com/freebook/asp/formtextarea.aspx I am convinced it is something to do with how textareas are handled in ASP because there is a tip at the bottom of the page about retaining hard-returns that a user types. It gives the following eg.
I think (but am probably completely wrong because I dont know much about ASP) that I need to incorporate this replacing of vbcrlf stored in the database with <br> at output and I reckon I need to do it in viewcart.asp here :-
I have messed around here for ages but cannot seem to crack it. I'll keep on trying |
||
thedeacon
Groupie Joined: 09-July-2006 Status: Offline Points: 0 |
Post Options
Thanks(0)
|
|
You're absolutely on the right track though :)
|
||
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |