Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Jan 2006
    Posts
    251
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    New Coder
    Join Date
    May 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #3
    Regular Coder
    Join Date
    Jan 2006
    Posts
    251
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    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
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #5
    Regular Coder
    Join Date
    Jan 2006
    Posts
    251
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    Kor,

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

    H8ids

  • #6
    Regular Coder
    Join Date
    Jan 2006
    Posts
    251
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    Kor,

    Tested it. Like it. May I use it?

    H8ids

  • #7
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    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.
    Last edited by Kor; 05-02-2006 at 08:44 PM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #8
    Regular Coder
    Join Date
    Jan 2006
    Posts
    251
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks again Kor.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •