Solved

Should be easy...

Posted on 2002-06-04
14
167 Views
Last Modified: 2010-04-09
How do I get a double quote AND a single quote to appear as a value in a text field?  What I want is to have the string:
"Mrs. O'Connel"
appear in a text box.  (Oversimplification, but it gets across what I need.)  I've tried:
<input type="text" value='"Mrs. O''Connel"'>
but I just get "Mrs.O as a value.  How do I get the literals in there????

allie
0
Comment
Question by:allie
  • 6
  • 3
  • 2
  • +3
14 Comments
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 50 total points
ID: 7054145
You have to escape the quotes and appostrophe this way:
<input type="text" value=' &#34;Mrs. O&#39;Connel&#34;'>


Cd&
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7054221
&#22; or %22 does not work with all browsers :-(

<input type=text value="O'Connel">
<input type=text value='O"Connel'>

but both mixed only if your browser supports HTML entitities in TAG attributes.
Probably you can do it with JavaScript ..
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 7054268
I got it to work with back-ticks in IE ... i don't know if this will work in all browsers:

value=`"O'Connel"`
0
 
LVL 18

Expert Comment

by:bruno
ID: 7054302
any way to do it XHTML compliant where the attribute is quoted propery?  

there should be, as that will soon be the standard...


BRUNO
0
 
LVL 2

Author Comment

by:allie
ID: 7054410
COBOLdinosaur and ahoffmann-

Excellent!  The "&#34" seems to be working!!  I'm a little concerned though about ahoffmann's comment that this may not work for all browsers... I'm using IE5, so which one's might it not work for?  If it's Netscape or IE6, that might be a problem.  If it's Opera or something like that I don't care as much... any info on how to find out what browsers use which escape codes??


Oh and BTW ahoffmann, I need to have both double and single quotes in the same field, so your example wouldn't work...  thanks though!

allie
0
 
LVL 2

Author Comment

by:allie
ID: 7054419
Oh yeah, also BTW, I saw in my HTML book that the escape sequence for the double quote (at least in URL encoding) is %22... but that didn't work at all here.  I had to use &#34 instead of &#22 or I didn't get the double quote (some other character appeared instead).  Wierd, but I thought I'd point it out...

allie
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7054900
I'm not sure which browsers will not support the escape characters.  

It is support by any browser that supports HTML3.2 or higher.

Specific browser support is:

IE since version 1
NS since version 1
opera since version 2.1

Based on references from WWw.blooberry.com.

I have not run across any browser that does not support the format, but there are a lot of fringe browsers around.

The complete list of support characters can be found at:
http://www.cwru.edu/hel/interHTML/examples/isolist0.html

Cd&
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7054902
Oops.  Typo in the link it should be:

http://www.cwru.edu/help/interHTML/examples/isolist0.html

Cd&
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 7055745
what happened to the good old days of the \ from the c++ legacy.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7055920
didn't dig deep (oops: nice acronym DDD) into the entitity problem, but know from experiance that following browsers do not what w3c recommends, or you expect:
   arachne, lynx, w3m, Netscape 4.x 6.x, Opera 4.x 5.x 6.x (not shure about 3.x), Konqueror 1.x 2.x, Mozilla 0.9.x

As I understand w3c docs, it's up to the browser how to implement these entitities in tag attributes, and that it is a CSS feature not HTML. But let me know if I missed some docs ;-)

I'm also suprised that some of the browsers behave strange (Netscape 6.x, Opera), but that's probably 'cause I only use "default" installations, and have not fiddled around with the browser's "user.css".

Hope this helps a bit.

BTW, didn't find a "Browser-Checks" list which have a check for this behaviour.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7056090
Support for major browsers show here.  A site which most who use it find very reliabel on cross-browser issues:

http://www.blooberry.com/indexdot/html/tagpages/c/charents.htm

Related Sites
Official References
http://www.rfc-editor.org/rfc/rfc1866.txt
RFC 1866: The HTML 2.0 specification (plain text.) Appendix contains Character Entity table.
http://www.w3.org/MarkUp/html-spec/html-spec13.html
The web version of the HTML 2.0 (RFC 1866) Character Entity table
http://www.w3.org/MarkUp/Wilbur/
The HTML 3.2 (Wilbur) recommendation
[This includes all character entities listed in HTML 2.0 plus new named entities covering the ISO 8859-1 120-191 range.]
http://www.w3.org/TR/REC-html40/
The HTML 4.0 Recommendation
[Includes new Unicode character entities]
http://www.w3.org/International/O-HTML.html
The W3C HTML Internationalization area
http://unicode.org <http://www.unicode.org
The Unicode Consortium site

Other Related Links

http://www.ramsch.org/martin/uni/fmi-hp/iso8859-1.html
Excellent resource with good pointers on ISO-8859 issues
http://ppewww.ph.gla.ac.uk/%7Eflavell/iso8859/iso8859-pointers.html
Alan Flavell's excellent document of pointers to information about ISO-8859
http://ppewww.ph.gla.ac.uk/%7Eflavell/iso8859/character-faq.txt
Alan Flavell's brief FAQ document regarding ISO-8859 issues in HTML
http://www.bbsinc.com/iso8859.html
Kevin J Brewer's page with MANY links regarding character set issues.

Cd&

0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7056098
If you have seen it in Netscrap 6, then you are seeing a buggy version.  You might want to check bugzilla to see what is documented.  There were a lot of presentation problems associated with 6.  Tens of thousands of bug reports.

Cd&
0
 
LVL 2

Author Comment

by:allie
ID: 7056133
COBOLdinosaur-

You don't seem like a dinosaur to me!  ;)  Thanks for the help, and the links - now if someone comes back to me and says it doesn't work in their browser I can find out why!

Thanks everyone!

allie
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7056207
Glad we could help.  Thanks for the A. :^)

Cd&
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

This article discusses four methods for overlaying images in a container on a web page
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now