codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  form  dkarun at 14:49 on Wednesday, February 09, 2005
 

Hi all,

I am having a from with a 2 radio option button with textboxes on each.second option buttons textfields are disabled by default so that first option buttons textboxes are enabled always.
The problem is when I click second option button the textboxes are enabled and when I submit and trying to come back again using the "back" in internet explorer the textboxes are disabled. I want those textboxes enabled while coming back.Is that anything with from events.Any one can there to figure it out.

Thanks in advance

Dkarun

  Re: form  tgreer at 15:48 on Wednesday, February 09, 2005
 

I couldn't follow the exact details. You didn't use apostrophes and possesives in your message, so it was hard to tell what belonged to what.

However - if you're having trouble with values not resetting, then look at the form's reset() method, and also the body's "onload" event.

It is simple to combine them to reset a form each time a page loads.



  Re: form  dkarun at 16:07 on Wednesday, February 09, 2005
 

More clear this time..

am having two option buttons. Under first option button I have a text box and a submit button,under second option button I have a textbox and a submit button.

While opening the page the first option button isthe checked one and the second option buttons textbox and submit button is disabled always set as disabled.

while clicking second option button first option buttons textbox and submit button is disabled, viceverse.

The problem is when I enter some value in second option buttons textbox and submit that and try to comeback to the same page using the "back" button in internet explorer it goes to the page where I entered the value but the textbox are disabled.

why disabled is because it is explictly setted as disabled while we open the page every time, when I try to come back its taking the default value.

I want the textboxes enabled while try to come back.

Is there any event or something to do this???

Can any one help me out in this.

Thanks in advance

dkarun


  Re: form  tgreer at 16:15 on Wednesday, February 09, 2005
 

Clicking the "back" button doesn't re-serve the page. The browser doesn't get the page from the server, it gets it from the local cache.

So the state of the page when you go "back" to it is the state where you left it.

You should set the page not to cache.

The behavior you're seeing is exactly what a typical web-user would expect to see, so there really isn't anything to "fix".


  Re: form  atdemmin at 14:34 on Tuesday, April 05, 2005
 

> So the state of the page when you go "back" to it is the state where you left it.

Actually, that is not exactly true. In fact, the desired effect would be to return to the previous state, but the problem is that even though the radio button on the form field is showing the previous selection, when you test the radio button fields to see which one is "checked", it returns the default checked value of when the form was initially loaded.

I am having this same problem with my application. I use the radio button "checked" status to determine what DIV areas should be displayed or hidden in the form. I want the user to be able to hit the back button after a submit. However when this happens, the radio button is showing the proper checked value, but the incorrect DIV sections are being displayed/hidden. It seems like the test for document.formname.radioname[x].checked is using the original checked value, not the actual checked state when the form was submitted.

Any comments/thoughts on this matter would be appreciated.


  Re: form  dev_noob at 18:41 on Friday, April 08, 2005
 

try to enable cache for this page or delete any codes like the following one in this page:

Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");
Response.ExpiresAbsolute = DateTime.Now.Date;
Response.Expires = -1;



  Re: form  atdemmin at 23:45 on Thursday, June 02, 2005
 

Some testing has shown that the "checked" status of radio buttons seems to be saved properly for the current versions of Netscape (7.2 and 8.0) and Mozilla Firefox (1.0.4), however they are not saved, at least in the same manner, for Internet Explorer (5.5 and 6.0). I haven't tried other browsers.

My opinion is that since all radio buttons seem to be displayed in their proper state after hitting the BACK button (this works on all of the browsers mentioned above), that the "checked" values of all radio buttons in a document should reflect the same state. This just doesn't seem to work with IE. A script that runs after the page is loaded will not be able to find the radio button that is truly checked. I don't think this has anything to do with caching, but rather the way the document object is implemented by IE as opposed to Netscape/Mozilla.

Again, any additional thoughts are appreciated. Currently, I have had to convert my RADIO elements to SELECT elements in order to get my application working as desired in all browsers. There seems to be no difference in how the "selectedIndex" value works in all browsers.


  RE: Checkboxes maintaining state on BACK  Troy Wolf at 00:11 on Monday, June 06, 2005
 

Why not use cookies? The only argument I've ever heard not to use cookies is that people may have cookies disabled. However, in 10 years of web development, I don't know of any user I've encountered who had cookies disabled.

As part of your code to ENABLE/DISABLE on radio check, store a cookie. Then, I'd use an window.onload event to always set the page elements according to the cookie value. Of course, you'll still need a default setup if the cookie does not exist.
Troy Wolf: site expert
SnippetEdit Website Editor









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  matrix addition
•  Re: Storing data from HTML to Excel or TXT
•  Re: function within loop problem
•  Re: Ô‡´ò¥¯¥é¥Ö¤à ¥Æ©`¥é©`¥á¥¤¥É£ò£±£±¥¢¥¤¥¢¥ó ¤Î£··¬ ¤Ç¤¹
•  Re: Replace
•  Re: タイトリスト AP2アイアン 712ã�®æƒ…å �
•  Re: SMS from Perl using HTTP request
•  Re: Charl Schwartzel
•  Re: Adhyayan - Annual Student Conference and Online Coding Festival


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2013