Slashes in value for input (FF)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PsychodelEKS
    New Member
    • Mar 2007
    • 2

    Slashes in value for input (FF)

    I've faced a problem recently, in my web app, I have a number of hidden inputs on the page to store (when generated on server) values for latter usage (on client size), one of them is:
    Code:
    <input name="my_id" type="hidden" value="part_one\\part_two">
    In Opera and IE (wow), it works great and I successfelly recieve "part_one\\part _two" when calling:
    Code:
    window.alert(document.getElementById('my_id').value);
    but in FF I get only "part_two"? any suggestions? (Except for pre-replaceing \\ to smth else before setting it as a value :) )
    Is that my bug or their?
  • epots9
    Recognized Expert Top Contributor
    • May 2007
    • 1352

    #2
    Hi PsychodelEKS welcome to TSDN,

    i created a test page with that code and tested it on firefox 2.0.0.6 and ie7, and it is working fine.

    when in your code are u calling getElementById? cuz if u do it too early it doesn't work...

    Comment

    • epots9
      Recognized Expert Top Contributor
      • May 2007
      • 1352

      #3
      Originally posted by PsychodelEKS
      I've faced a problem recently, in my web app, I have a number of hidden inputs on the page to store (when generated on server) values for latter usage (on client size), one of them is:
      Code:
      <input name="my_id" type="hidden" value="part_one\\part_two">
      In Opera and IE (wow), it works great and I successfelly recieve "part_one\\part _two" when calling:
      Code:
      window.alert(document.getElementById('my_id').value);
      but in FF I get only "part_two"? any suggestions? (Except for pre-replaceing \\ to smth else before setting it as a value :) )
      Is that my bug or their?
      after looking closer i see an error, your input has no id attribute, should be

      [html]
      ]<input id="my_id" name="my_id" type="hidden" value="part_one \\part_two">
      [/html]

      in order to get it to work with the javascript

      good luck

      Comment

      • PsychodelEKS
        New Member
        • Mar 2007
        • 2

        #4
        Originally posted by epots9
        after looking closer i see an error, your input has no id attribute, should be

        [html]
        ]<input id="my_id" name="my_id" type="hidden" value="part_one \\part_two">
        [/html]

        in order to get it to work with the javascript

        good luck
        OMG, much thanks, epots9, I should work less and sleep more =) I was confused by the fact it worked in Opera and IE as expected.

        Comment

        • epots9
          Recognized Expert Top Contributor
          • May 2007
          • 1352

          #5
          Originally posted by PsychodelEKS
          OMG, much thanks, epots9, I should work less and sleep more =) I was confused by the fact it worked in Opera and IE as expected.
          yes ie makes it own rules where FF wants the correct ones.

          come back anytime u need help.

          Comment

          Working...