...

View Full Version : Is this possible?



h8ids
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.
Thanks

mildlyincoheren
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.

h8ids
05-02-2006, 05:10 PM
mildlyincoheren,

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.

Kor
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++){
e[i].disabled?e[i].removeAttribute('disabled'):null;
}
}
</script>
........
<form onsubmit="return enable(this.elements)">

h8ids
05-02-2006, 06:46 PM
Kor,

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

H8ids

h8ids
05-02-2006, 06:56 PM
Kor,

Tested it. Like it. May I use it?

H8ids

Kor
05-02-2006, 09:42 PM
Kor,

Tested it. Like it. May I use it?

H8ids
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:

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum