473,785 Members | 2,843 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem: Safari inserting br tags where textarea wraps...

2 New Member
Hello all,

built a simple site using a CMS combining MySQL for the back end and PHP to display it all. I have an admin page that has a form comprising of several textareas so the client can update the contents of the site himself.

Any formatting - eg. user line breaks - is inserted into the database and works a-ok. However, when using Safari (I'm running OS X 10.5.1 and Safari 3.0.4), all the line-ends - ie. where the text wraps in the individual textareas - are somehow inserted into the database as <br>. This bug only occurs in Safari.

I have wasted an hour on this and I cannot find any solutions online that work for me. I found a thread with someone who had a similar problem, and the suggestion was to make sure to insert
Expand|Select|Wrap|Line Numbers
  1. wrap="soft"
or
Expand|Select|Wrap|Line Numbers
  1. wrap="virtual"
in order to prevent Safari displaying this behavior. Unfortunately, that does not work for me.

I was hoping that someone here would have come across this problem before and could tell me why this is happening / a solution. To reiterate, there are no problems with the coding of the page as this is only happening in safari, not IE6/7 or Firefox.

Cheers
Jan 6 '08 #1
4 4013
drhowarddrfine
7,435 Recognized Expert Expert
I found a thread with someone who had a similar problem, and the suggestion was to make sure to insert
Expand|Select|Wrap|Line Numbers
  1. wrap="soft"
or
Expand|Select|Wrap|Line Numbers
  1. wrap="virtual"
in order to prevent Safari displaying this behavior. Unfortunately, that does not work for me.
Considering the fact that there is no such thing as "wrap", yes, it won't work.

No browser generates html on its own. This problem must lie elsewhere.
Jan 6 '08 #2
fredsterss
2 New Member
Considering the fact that there is no such thing as "wrap", yes, it won't work.

No browser generates html on its own. This problem must lie elsewhere.
I realise that this code is depreciated. However, it was suggested that this may work anyway. The problem clearly lies with the browser as all the other browsers behave exactly as they should. Does anyone else have a helpful suggestion?
Jan 7 '08 #3
drhowarddrfine
7,435 Recognized Expert Expert
I realise that this code is depreciated.
You can't deprecate something that never existed. This is an IE only attribute which I never even heard of until I just now Googled. afaik, no other browser supports it.
The problem clearly lies with the browser
Then please tell us how any browser generates markup all by itself.
as all the other browsers behave exactly as they should. Does anyone else have a helpful suggestion?
If you want to continue to live in a world of made up attributes, no one can help you.
Jan 7 '08 #4
astangeland
26 New Member
I think drhowarddrfine is always helpful like that. The wrap attribute not only exists as a proposed standard (proposed by Netscape for HTML 3.0), but it has even been implemented by Netscape, Firefox, Safari, and IE (at least, I don't know about which others). The term deprecation is used to indicate discouragement of usage of a particular software feature, usually because it has been superseded by a newer/better version. Which doesn't have anything to do with standards. The only one living in a made up world is drhowarddrfine himself.

It does sound entirely possible that when form data is posted to the server that Safari takes the visual data from the form and converts it to different markup than the other browsers do. However I've never heard of it happening, and I can't repeat it. Setting the wrap attribute to "hard" makes it send the line breaks from the user's GUI display of the textbox. But I can't see anything that would make it convert those to <br> tags.

Perhaps a little more information is in order.

Are these text-wrap line breaks, carriage return line breaks, or both?
Is this Strict or Quirks mode and what Doctype are you using, if using one at all?
What attributes did you use on the form tag and textarea tag?
Are you certain that there is not some kind of server-side post processing of the form data taking place. It's possible that Safari adds a different kind of line-break than the other browsers and your script converts that to <br> while the other scripts don't. Just make sure we know what we're looking for. An easy way to check would be to dump the POST or GET data as soon as it is received and view the source to see if the <br> tags are already in there or not.

You also should be aware that something like <textarea>Lin e One<br>Line Two</textarea> will display <br> on the screen instead of a line break and will send it to the database as well.
Jan 7 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
11237
by: Mark Szlazak | last post by:
The following code fails in Firefox to get at selected text in the right-side textarea. Any help would be appreciated. <html> <head> <script> var agt = navigator.userAgent.toLowerCase(); var safari = ((agt.indexOf('safari') != -1) && (agt.indexOf('mac') != -1))? true:false; var opera = (window.opera)? true:false;
2
17080
by: cbjewelz | last post by:
Hey all. So I'm having problems with cross browser alignments. I'm looking at Safari and Mozilla Firefox. I develop in Safari and so it looks perfect there however in Firefox my vertical alignments and div widths are off. It's as if firefox has a different definition of a pixel than safari. Here is the url: http://theprize.chemouni.com/testing.php. When you select the Option from the pull down, the first part of the form appears. Then when...
3
8187
by: zjw2112 | last post by:
Hello. I have some javascript code that dynamically creates a textarea and sets the wrap value to hard, which I thought would preserve CR/LF in the textarea: var otherTextArea = document.createElement("textarea"); otherTextArea.setAttribute("rows", "10"); otherTextArea.setAttribute("cols", "30"); otherTextArea.setAttribute("id", "otherTextArea"); otherTextArea.setAttribute("wrap", "hard");
2
2903
by: dennis.sprengers | last post by:
Ik ben bezig met een eigen UBB editor. Als iemand aan het typen is, zorgt CTRL-B voor een \-tag en nogmaals CTRL-B voor een \ tag. Als je eerst een selectie maakt en dan CTRL-B drukt, wordt de selectie ingesloten door \ en \, net als hier op GoT. Wat ik nu probeer is, om de B-knop uit de toolbar te laten oplichten als de cursor op een woord staat dat omgeven is door B-tags: I'm trying to write my own UBB editor. If a user types...
3
4942
by: MikeK | last post by:
Ok, I've been noodling with this for several days now and I'm starting to go crazy. Does Apple's Safari browser support drag events on Textarea elements? The few specs and docs I've found seem to indicate that it does but I can't get it to work for the life of me. I've tired everything I can think of to try get notifications for the events: ondragenter ondragleave ondragover ondrop
20
2281
by: Tony B | last post by:
I'm learning a little about using forms in php to enter data, and have a couple of questions re textarea. At the moment I just use "addslashes() to process the value from textarea so that punctuation is escaped, and write this into a table. When the text wraps in the text box I get a new line in the value returned, as well as new lines that I enter manually. Is it possible to remove the wrap new line but keep the user entered new line ?
0
10329
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10152
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8974
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.