Skip to main content

Posts

Showing posts from June, 2010

damn you javascript

I have be using more javascript and css than I would like recently, but the power is amazing. My most recent revelation was that "read only" is for suckers, and using "disabled" is a better way to protect elements in forms from user access.  the main reason is because you can set disabled=[true|false] on any input:  text, select, checkbox etc. I used a css selector to make the disabled elements look a little nicer: input[disabled="disabled"] {color:black; background-color:gray;} So now I could have an edit button.  Click the edit button and Pseudocode: for (all elements in form){ element.disabled=false; } click the cancel button and: for(all elements in form){ element.disabled="disabled";//don't set true because of css selector } That actually didn't work. SCREW YOU JAVASCRIPT. However I made a css "formActive" and "formInactive" .formInactive{ padding: 1px 0px 1px 0px; border-width: 0; ...