From: Cere Davis Date: 2004-06-12T06:01:22+09:00 Subject: Re: cgi maintaining state information Ah, I think I understand your point here. And there is any easy way to make the form fields represent what is being posted in. This is not so easy for checkboxes and radio buttons though. It seems that in the case where a users wants this type of behavior there should be some kind of option to at least allow the checkboxes to show up as checked if the attribute value is true. >> You are asking the CGI module to automatically retain the selected value attribute passed as a parameter into the new form? Why should it? It may be a completely different form, where the name has other semantics. >> The CGI API requires the selected value to be explicitly given, which is the correct and safe way to do it. (Your suggestion reminded me of PHP and the automatically mapping to globals variables it used to have.) >> However, there is nothing stopping you from writing your own modifications to the cgi module doing what you want. (I.e. all default values are taken from the input parameters if nil.) But please understand that this means that _default_ values in your form may be from external sources and thus dangerous! I don't think there is anything inherently dangerous about making a forms physical appearence update to represent the values that are posted in as long as no javascript type action is taken on valus submitted to the form by default. It what you do with those values afterwards that matters. Actually, I am working on this but but I am new to this and am trying figuring out how to override a function in the cgi library at the moment.... I have a thing like: class CGI def checkbox((name = "", value = nil, checked = nil) ....stuff in place of the default behavior of cgi.rb checkbox end end But my code doesn't seem to recognize this overriden function. Does anyone know how I can override functions like this? Thanks, -Cere