+ Reply to Thread
Results 1 to 5 of 5

Thread: edit one at a time

  1. #1
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    471
    Rep Power
    4

    edit one at a time

    hi
    i have dynamically created edit button used to edit a single coulmn in list.
    when click on edit button the column which has to be edit become editable textbox.
    what i want to do is at time only one editable text box should display.other texbozes if they are then should hide.
    Code:
    function fnToggle(vlCounter)
    {
    		
    frm = window.document.frmProtocolSettings for ( var f = 0; f < frm.elements.length; ++f ) { // get one field var fld = frm.elements[f]; // see if it is one of our txtbox fields if ( fld.name.substring(0,10) == "txtBoxRow_" ) { fld.style.display = "none"; } }
    document.getElementById("txtRow_" + vlCounter ).style.display = "none"; document.getElementById("txtBoxRow_" + vlCounter ).style.display = ""; document.getElementById("RowEdit_" + vlCounter ).style.display = "none"; document.getElementById("RowSave_" + vlCounter ).style.display = ""; document.getElementById("RowCancel_" + vlCounter ).style.display = ""; }
    this is the function called on each click on edit button.
    Love is physical attraction and mental destruction

  2. #2
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    471
    Rep Power
    4

    hi txtBoxRow is my span id.i want to show and hide this span id .
    Love is physical attraction and mental destruction

  3. #3
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    If I understand you correctly, you have a few rows of data. You click one row, but then decide to click another row to edit. When doing this, you want the previous row to hid the textboxes, correct?

    If so, get the total count of your rows. Then, in your function, perform a For Loop to iterate through the fields and set the display:none; property. Be sure to have a clause in there so that when the counter reaches the row you want to leave editable, it will skip over it.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  4. #4
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    471
    Rep Power
    4

    JMH same logic i was trying but problem is in same function i m making text box display inline.see my function u will get idea
    Code:
    function fnToggle(vlCounter)
    {	
    		var i;
    		document.getElementById("txtRow_" + vlCounter ).style.display = "none";
    		document.getElementById("txtBoxRow_" + vlCounter ).style.display = "";		
    		document.getElementById("RowEdit_" + vlCounter ).style.display = "none";
    		document.getElementById("RowSave_" + vlCounter ).style.display = "";
    		document.getElementById("RowCancel_" + vlCounter ).style.display = "";
    		for(i=0;i<=document.getElementById("HTotalCount").value;i++)
    		{
    			if(i != vlCounter )
    			{
    				//document.getElementById("txtBoxRow_" + i ).style.display = "none";
    			}
    		}
    		
    		
    }
    
    see the bold line in function here i m creating or displaying my span tag. and when i trying to use this span in my loop as said by u showing me object expected javascript error.
    meant my loop not getting that span which is just above the loop has been displayed.how can i get that span.

    hope it make some sense.

    Thanks for your time.
    Love is physical attraction and mental destruction

  5. #5
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    471
    Rep Power
    4

    sorry gotted now this way
    eval(document.getElementById("txtBoxRow_" + i )).style.display = "none";

    its my mistake thanks a lot.
    Love is physical attraction and mental destruction

+ Reply to Thread

Similar Threads

  1. Time Entry Form
    By sbenj69 in forum Access Database Samples
    Replies: 5
    Last Post: May 1st, 2009, 06:48 AM
  2. edit with text box
    By guddu in forum JavaScript Programming
    Replies: 10
    Last Post: August 20th, 2008, 12:15 PM
  3. keep time and date
    By javier_83 in forum Microsoft Access
    Replies: 6
    Last Post: August 15th, 2008, 07:03 PM
  4. JavaScript Date & Time Display
    By jmurrayhead in forum JavaScript Code Samples
    Replies: 0
    Last Post: August 13th, 2008, 09:46 PM
  5. Site Down Time
    By jmurrayhead in forum Announcements
    Replies: 0
    Last Post: March 30th, 2008, 10:42 AM

Bookmarks

Posting Permissions

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

SEO by vBSEO