How to retain the text box contents when page is refreshed.

Need technical advice on coding your web pages? Covers HTML, JavaScript, CSS, and some server side technologies. Also the issue of some webpages not displayed well.

Moderator: Don_HH2K

How to retain the text box contents when page is refreshed.

Postby cars » Thu 07 Apr, 2005 7:02 am

When I refresh a page using javascript then textbox contents will disappear. If I pass the contents of the text as parameter then the formatting of the text will change and also if length of the text increases then page does not refresh but gives javascript error. The text box contents can go upto 15000 characters. What is the best way to solve this problem? Please help in this issue. Iam stuck.... Any suggestions would be appreciated...
UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)
cars
new member
new member
 
Posts: 4
Joined: Mon 04 Apr, 2005 2:44 am

Postby Antony » Mon 11 Apr, 2005 8:42 pm

Hello,

If the content has sent to the server, it is possible to have the content filled in (from server) when people refresh the page.
If the data is not yet submitted to the server, it would depend on user's browser, in my knowledge.
UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.5) Gecko/20041103 Firefox/1.0RC2
User avatar
Antony
diamond member
diamond member
 
Posts: 14509
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia

Postby cars » Mon 11 Apr, 2005 10:40 pm

Hi,
Thanks... I am using window.location.href in javascript by passing the parameters to the page. The problem may be (not sure) that the length of the URL is exceeding the limit for Internet Explorer. At present its been tested on IE. This error happens when the contents of the parameters is beyond some limit which I am not able to estimate. The javascript returns an error 'Invalid syntax'.
UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)
cars
new member
new member
 
Posts: 4
Joined: Mon 04 Apr, 2005 2:44 am

Postby Antony » Mon 11 Apr, 2005 11:22 pm

I am not sure what is your idea to achieve this. You can use the form's submit button and make a preview page, as most websites do this way.
You can try "post" or "get" method, this could be easier than JavaScript's refresh method.
UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.5.7 (KHTML, like Gecko) Safari/125.12
User avatar
Antony
diamond member
diamond member
 
Posts: 14509
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia


Return to Web Design and Page Coding

Who is online

Registered users: Google [Bot]