View Full Version : Is this possible?

05-01-2006, 08:59 PM
Dynamically loading data into page. The page does allow the user to save changes back to the database.

I'd like to have the data to be visible but not edittable; as a default setting.

The user should be able to select which specific data they want to edit, Then save the changes, along with the rest of the data, back to the database.

I know "disabled" won't allow the desired effect. But the each field should be inactive, till the user activates one/two/etc. for editting.

Newbie, just needing a hint.

05-02-2006, 02:06 PM
This is more of a problem for PHP than for JavaScript.

If you wanted a smooth transition (no need to submit the page to get the ability to change it) then you'll probably want to use Ajax. A more unweildy version (but easier to code) would just to put checkboxes next to each entry, allow the user to select which ones they want to edit, and then submit the page which'd generate a new one based on which boxes they checked.

05-02-2006, 05:10 PM

Thanks for the suggestion.
I will look closer at AJAX. I understood AJAX to be the use of JavaScript, DHTML, PHP, etc. in comparison to Flash.

I am puzzled about your "This is more of a problem for PHP than for JavaScript."
Thinking the HTML would define field(s) initial state; JavaScript would adjust the field(s) state based upon user input.
JavaScript's onFocus and onBlur commands have been sketchy across browsers.
While using disabled would automatically remove record data during the save process. Readonly is good for text boxes but I'm using radio and listboxes too.

Considering onSelect for field highlighting; if I can't lock fields prior to use, I'll draw obvious attention to their selection. Maybe this will curve potential errors.

05-02-2006, 06:01 PM
You may still use readonly and disabled and, onsubmit, return calling a function which will remove the disabled attributes, if any, of the elements, to be able to send all their values back to the DB:

something like

<script type="text/javascript">
function enable(e){
for(var i=0;i<e.length;i++){
<form onsubmit="return enable(this.elements)">

05-02-2006, 06:46 PM

How long have you been coding? You seem to know it all. :)
I'll take your suggestion into consideration.


05-02-2006, 06:56 PM

Tested it. Like it. May I use it?


05-02-2006, 09:42 PM

Tested it. Like it. May I use it?

Sure... :) This is the reason of a forum, I guess, to spread/share knowledge so that all of us we might be better and better all the time. Human race had/has no other option. :thumbsup:

05-03-2006, 03:44 PM
Thanks again Kor.:thumbsup: