Connecting Tech Pros Worldwide Help | Site Map

Slashes in value for input (FF)

Newbie
 
Join Date: Mar 2007
Location: Russia, Moscow
Posts: 2
#1: Jul 31 '07
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:
Expand|Select|Wrap|Line Numbers
  1. <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:
Expand|Select|Wrap|Line Numbers
  1. 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's Avatar
Moderator
 
Join Date: May 2007
Location: Canada
Posts: 1,313
#2: Jul 31 '07

re: Slashes in value for input (FF)


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...
epots9's Avatar
Moderator
 
Join Date: May 2007
Location: Canada
Posts: 1,313
#3: Jul 31 '07

re: Slashes in value for input (FF)


Quote:

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:

Expand|Select|Wrap|Line Numbers
  1. <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:
Expand|Select|Wrap|Line Numbers
  1. 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
Newbie
 
Join Date: Mar 2007
Location: Russia, Moscow
Posts: 2
#4: Jul 31 '07

re: Slashes in value for input (FF)


Quote:

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.
epots9's Avatar
Moderator
 
Join Date: May 2007
Location: Canada
Posts: 1,313
#5: Jul 31 '07

re: Slashes in value for input (FF)


Quote:

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.
Reply


Similar JavaScript / Ajax / DHTML bytes