Go Back   DeveloperBarn Forums > Programming & Scripting > JavaScript Programming

Sponsored Links

Discuss "edit one at a time" in the JavaScript Programming forum.

JavaScript Programming - Javascript is a cross-browser client-side scripting language. Discuss Javascript and AJAX related scripts here.


Reply « Previous Thread | Next Thread »  
 
LinkBack Thread Tools Display Modes
  #1  
Old August 21st, 2008, 08:12 AM
guddu's Avatar
Barn Frequenter

 
Join Date: Jul 2008
Location: Oxford UK
Posts: 129
Thanks: 6
Thanked 3 Times in 2 Posts
Rep Power: 1
guddu is on a distinguished road
Default 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
Reply With Quote
Sponsored Links
  #2  
Old August 21st, 2008, 08:19 AM
guddu's Avatar
Barn Frequenter

 
Join Date: Jul 2008
Location: Oxford UK
Posts: 129
Thanks: 6
Thanked 3 Times in 2 Posts
Rep Power: 1
guddu is on a distinguished road
Default

hi txtBoxRow is my span id.i want to show and hide this span id .
Reply With Quote
  #3  
Old August 21st, 2008, 09:54 AM
jmurrayhead's Avatar
The Barnfather

 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 820
Thanks: 20
Thanked 74 Times in 71 Posts
Blog Entries: 5
Rep Power: 3
jmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura about

Awards Showcase
Microsoft Windows Microsoft .Net Microsoft SQL Server Classic ASP 
Total Awards: 4

Default

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.

Comments on this post
guddu agrees: Thanked Post
__________________
jmurrayhead
If you agree with me... click the icon!
If my post solved your problem, click the button in the lower right-hand corner of the post.

Join our Folding team: DeveloperBarn Folding
Reply With Quote
The Following User Says Thank You to jmurrayhead For This Useful Post:
guddu (August 21st, 2008)
  #4  
Old August 21st, 2008, 10:53 AM
guddu's Avatar
Barn Frequenter

 
Join Date: Jul 2008
Location: Oxford UK
Posts: 129
Thanks: 6
Thanked 3 Times in 2 Posts
Rep Power: 1
guddu is on a distinguished road
Default

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.
Reply With Quote
  #5  
Old August 21st, 2008, 10:57 AM
guddu's Avatar
Barn Frequenter

 
Join Date: Jul 2008
Location: Oxford UK
Posts: 129
Thanks: 6
Thanked 3 Times in 2 Posts
Rep Power: 1
guddu is on a distinguished road
Default

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

its my mistake thanks a lot.
Reply With Quote
Reply

  DeveloperBarn Forums > Programming & Scripting > JavaScript Programming

Bookmarks

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
edit with text box guddu JavaScript Programming 10 August 20th, 2008 11:15 AM
keep time and date javier_83 Microsoft Access 6 August 15th, 2008 06:03 PM
[JavaScript] JavaScript Date & Time Display jmurrayhead Code Samples 0 August 13th, 2008 08:46 PM
Time Entry Form sbenj69 Microsoft Access 2 July 14th, 2008 02:11 PM
Site Down Time jmurrayhead Announcements 0 March 30th, 2008 09:42 AM


All times are GMT -4. The time now is 05:44 PM.



Content Relevant URLs by vBSEO 3.2.0