Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OnTextChanged event and postback

Status
Not open for further replies.

newmem

Programmer
Jul 23, 2002
35
0
0
US
I have few textboxes on my data entry form and a submit /Cancel button.
When a user hits <ENTER> in the textbox, the it's OnTextChanged event gets fired and thereafter the Submit button's click event is executed.
Is this behaviour by design? Are there any ideas to get around this?

Thanks!
 
Write a Javascript to capture the &quot;Enter Key&quot; and setfocus on the next object.
The Javascript is
function translatekey(param)
{
if (window.event.keyCode ==13)
{window.event.returnValue = false;
document.all[param].focus();}
}
</script>
call this event on the Textbox's onkeypress event like
<asp:textbox onkeypress=&quot;translatekey('name') ;&quot; id=name></asp>

I think this will work. Let me know.
LJS
 
Why do you want to change this?
The OntextChanged event is fired anytime the cursor leaves a field and the text inside it is changed. Well, that is as long as there has been something coded for that event. As for the submit wouldn't that be a desirable action to happen?

I am asking because it is better to stick with what the user already expects to happen on the web rather than inventing a whole new routine. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top