home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 2681
Discussions: 186,607, Posts: 2,227,048, Members: 230,241
Free Scan: Update Your PC's Outdated Drivers to Optimize Performance
Old July 16th, 2008, 11:15 AM   Digg it!   #1 (permalink)
Junior Member
 
Join Date: Jul 2008
Posts: 1
javascript: remove text after focus change

I have a gridview I am using some javascript to make a column un-editable (the built in editable=false does not suit my needs). My work around is to move focus to the next cell on keydown. This works fine but the key the user enters is entered into the new cell. I don't want the key passed after the focus move, or delete it immediately after the focus change. My code extract is below. I capture the new cell's text before moving focus to it then I set the new cell's text to what it was before focus change. But the entered keystroke is added at end regardless of where I place the .focus(). Is there any other way to move focus on keydown and not pass the key to the new focus location? Or to delete the passed key after focus change?

//make column uneditable by moving focus
if (colNum==0)
{
newFieldName = strGridName + "_ctl"+row+":_ctl"+nextCol;
el = document.getElementById(newFieldName).createTextRa nge();
var PreText = el.text; //capture new cell's text before focus
returnValue = false;
}
break;
} //end of switch case

newTextBox = document.getElementById(newFieldName);
if(null != newTextBox){
newTextBox.focus(); //move focus
if(null != PreText){
ReDo = document.getElementById(newFieldName).createTextRa nge();
alert(PreText);
ReDo.text = PreText; //set text to what it was earlier

}
return returnValue;

}

ric_the_red is offline   Reply With Quote
TechIMO.com Ads - Login or register for less ads.
How many errors does your computer have?

You no longer need to guess! This free stability scan and registry cleaner download will give you a complete diagnosis of your Windows registry, identifying errors and conflicts.

FREE instant scan


Guest, Register Free! to remove this ad and get your tech support questions answered in minutes!
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Regain Focus new_guy217 DebateIMO: Politics, Religion, Controversy 0 February 20th, 2008 07:33 PM
Change picture / text on mouse-over FatalException Webmastering and Programming 3 January 3rd, 2007 04:10 PM
Anotherone I can't oversee (dynamically change text) c6ke Webmastering and Programming 2 August 14th, 2006 04:51 AM
How change lots of Windows default paths; how remove Wins default programs? Wai_Wai Applications and Operating Systems 12 July 24th, 2004 03:36 PM
Change text color in IE toolbar? PuddingShorts Applications and Operating Systems 0 December 28th, 2002 08:23 PM

Most Active Discussions
Is It Just Me? (528)
Misery Loves Company... (1849)
Why Does the MOON Grow Bigger as It.. (18)
heatsink issue (10)
New Mobo (18)
UPGRADING C/D DRIVE TO 250GB & .. (14)
SSD's, RAID, and External Backup (7)
1 internet. 1 house. 3 computer. ho.. (13)
Is This A Compatible Gaming PC? (18)
Recent Discussions
system restore 'next' button wo.. (1)
firewall (1)
C++ compiler suggestions (4)
Official World of Warcraft Thre.. (4529)
Programming question (2)
UPGRADING C/D DRIVE TO 250GB &a.. (14)
Ubuntu or Xubuntu....anyone!!? (7)
Building my first PC and need s.. (0)
PNY vs Gainward (3)
FS: Dell 6000 laptop, modded 36.. (2)
Apple iPod touch 16 GB $200 (4)
Six 28-Disc Cross Design Black .. (4)


All times are GMT -4. The time now is 11:59 AM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28