Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-01-2006, 07:59 PM   PM User | #1
h8ids
Regular Coder

 
Join Date: Jan 2006
Posts: 251
Thanks: 0
Thanked 0 Times in 0 Posts
h8ids is an unknown quantity at this point
Question Is this possible?

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
h8ids is offline   Reply With Quote
Old 05-02-2006, 01:06 PM   PM User | #2
mildlyincoheren
New Coder

 
Join Date: May 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
mildlyincoheren is an unknown quantity at this point
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.
mildlyincoheren is offline   Reply With Quote
Old 05-02-2006, 04:10 PM   PM User | #3
h8ids
Regular Coder

 
Join Date: Jan 2006
Posts: 251
Thanks: 0
Thanked 0 Times in 0 Posts
h8ids is an unknown quantity at this point
Thumbs up

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.
h8ids is offline   Reply With Quote
Old 05-02-2006, 05:01 PM   PM User | #4
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
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
PHP Code:
<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)"> 
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Old 05-02-2006, 05:46 PM   PM User | #5
h8ids
Regular Coder

 
Join Date: Jan 2006
Posts: 251
Thanks: 0
Thanked 0 Times in 0 Posts
h8ids is an unknown quantity at this point
Smile

Kor,

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

H8ids
h8ids is offline   Reply With Quote
Old 05-02-2006, 05:56 PM   PM User | #6
h8ids
Regular Coder

 
Join Date: Jan 2006
Posts: 251
Thanks: 0
Thanked 0 Times in 0 Posts
h8ids is an unknown quantity at this point
Question

Kor,

Tested it. Like it. May I use it?

H8ids
h8ids is offline   Reply With Quote
Old 05-02-2006, 08:42 PM   PM User | #7
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
Quote:
Originally Posted by h8ids
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.
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

Last edited by Kor; 05-02-2006 at 08:44 PM..
Kor is offline   Reply With Quote
Old 05-03-2006, 02:44 PM   PM User | #8
h8ids
Regular Coder

 
Join Date: Jan 2006
Posts: 251
Thanks: 0
Thanked 0 Times in 0 Posts
h8ids is an unknown quantity at this point
Thanks again Kor.
h8ids is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:10 PM.


Advertisement
Log in to turn off these ads.