Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Aug 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Input "CheckBox", some values are encoded

    I have some input checkboxes on a standard HTML form that contain long values. Some of these values must be too long because instead of showing up like this:

    <input type="checkbox" name="Standards_1" value="[&lt;A HREF=&quot;#&quot; onClick=&quot;javascript:loadStand('PC.3.220'); return false;&quot;&gt;PC.3.220 - From PC.3.140 Not applicable&lt;/A&gt;]"><A HREF="#" onClick="javascript:loadStand('PC.3.220'); return false;">PC.3.220 - From PC.3.140 Not applicable</A><br>

    They show up instead like this one:

    <input type="checkbox" name="Standards_1" value="_vbcu42828a92kcf924ch20rre8dm6iorb7kh6kobmc5pm6sj9e1q3kr3fc5i56t31dpi2g9qg8cn36bhi6co2ea9r41p 6at3le9n20pj1dhpmaep27p846bhj5op36c105kg48qb1ctn6usrkd5hi0t35edq6irj741q6u834clq6asjdd5n6a83kd1ii0s3 1ehkmarjk04m76838clgmot3841hm2sj541n6apb4ecg6isp0e1in4pjfe9mmap1e7gnk2fit_"><A HREF="#" onClick="javascript:loadStand('PC.3.230'); return false;">PC.3.230 - Diagnostic testing to determine the patient’s health care needs is performed.</A><br>

    When I use JavaScript to read the "value" of the field I get this encoded text. Very useless I'm afraid.

    I guess what I need is either one of two things. I need to either figure out what this encoded text is encoded in and decode it or find some way to read the un-encoded text on the outside of the input value. I've tried to use innerHTML and outerHTML, but it won't grab the unencoded text. Is there another way to grab this text or does anyone know what this encoded text is encoded in and how to use a JavaScript to decode it?

    Any and all suggestions are greatly appreciated. I'm afraid I haven't come across this before and I'm baffled. I've searched around a lot but after several hours of fruitless efforts I thought of my favorite forum for help. Thanks again.

    <<<<TIM>>>>

  • #2
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by skylab
    I have some input checkboxes on a standard HTML form that contain long values. Some of these values must be too long because instead of showing up like this:

    <input type="checkbox" name="Standards_1" value="[&lt;A HREF=&quot;#&quot; onClick=&quot;javascript:loadStand('PC.3.220'); return false;&quot;&gt;PC.3.220 - From PC.3.140 Not applicable&lt;/A&gt;]"><A HREF="#" onClick="javascript:loadStand('PC.3.220'); return false;">PC.3.220 - From PC.3.140 Not applicable</A><br>

    They show up instead like this one:

    <input type="checkbox" name="Standards_1" value="_vbcu42828a92kcf924ch20rre8dm6iorb7kh6kobmc5pm6sj9e1q3kr3fc5i56t31dpi2g9qg8cn36bhi6co2ea9r41p 6at3le9n20pj1dhpmaep27p846bhj5op36c105kg48qb1ctn6usrkd5hi0t35edq6irj741q6u834clq6asjdd5n6a83kd1ii0s3 1ehkmarjk04m76838clgmot3841hm2sj541n6apb4ecg6isp0e1in4pjfe9mmap1e7gnk2fit_"><A HREF="#" onClick="javascript:loadStand('PC.3.230'); return false;">PC.3.230 - Diagnostic testing to determine the patient’s health care needs is performed.</A><br>

    When I use JavaScript to read the "value" of the field I get this encoded text. Very useless I'm afraid.
    Then it would be interesting to know how you're doing that reading, as you should be getting:

    [<A HREF="#" onClick="javascript:loadStand('PC.3.220'); return false;">PC.3.220 - From PC.3.140 Not applicable</A>]

  • #3
    New Coder
    Join Date
    Aug 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Items are different checkbox values

    The items (examples) I posted were values from the checkbox list of values. Some of the items in the list are encoded, others are not. I'm guessing since the values are longer than a certain length, they must be encoded by the browser. I'm trying to determine what they are encoded in and be able to read them as text and not code. If I ask for the value of the item though all I get is the code, text, or whatever that particular value is in the list.

    Any additional thoughts anyone?

    Thank you for your views and posts.

    <<<<TIM>>>>

  • #4
    New Coder
    Join Date
    Aug 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Figured It Out!

    Ok, folks, listen up. I figured this out. I'm surprised no one has encountered this before.

    In HTML, if a value, either for use in a checkbox or radio button has an old-style apostrophe, that's right, an old-style apostrophe ( ’ ) it will convert that value to some encoded value. Don't ask me how to decode what it is since everything I've tried doesn't work. It must be something specific to the browser session or something. Basically you can't use that apostrophe, instead you either need to change it to a single quote also known as the new apostrophe ( ' ) or change it to it's equivalent HTML ( &_#39; (Minus the "_") ) which will display a new style apostrophe, but the value will keep the HTML.

    I've looked everywhere for the html value of the old-style apostrophe ( ’ ), but no luck. I guess it's dead and gone. I'm using text from a source that has older style formatting, like this old-style apostrophe, thus I ran into this.

    Now you know. No old-style apostrophes in values or they'll be encoded and you won't be able to see the value via javascript without seeing the encoded stuff.

    Enjoy!

  • #5
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,518
    Thanks
    3
    Thanked 506 Times in 493 Posts
    I've looked everywhere for the html value of the old-style apostrophe ( ’ )
    '\u2019'
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #6
    New Coder
    Join Date
    Aug 2004
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    I've also found that the double hyphen "–" also makes the value become encoded. Just an FYI I thought I'd pass along to anyone reading this post.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •