By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,568 Members | 1,196 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,568 IT Pros & Developers. It's quick & easy.

javascript to detect textbox

P: n/a
Hi,

I am wondering if any of you Javascript experts can enlighten me on
which event to call. The use situation is that the tetxbox field is
populated from the DB and the add/update and delete will work only when
a textbox for reason for change is entered. This mean if a user simply
type in the same value as before, the ASP.NET textbox will be marked
with changed. But it should not limit that a user can not change the
whole value in the textbox at all.

I have looked at keyup, mousedown, etc. but it will calling the
function after every key is entered and that is what I don't want to
happen. I would appreciate if anyone can point me out here.

Thank you in advance,
Sunny

Aug 29 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

su******@yahoo.com wrote:
Hi,

I am wondering if any of you Javascript experts can enlighten me on
which event to call. The use situation is that the tetxbox field is
populated from the DB and the add/update and delete will work only when
a textbox for reason for change is entered. This mean if a user simply
type in the same value as before, the ASP.NET textbox will be marked
with changed. But it should not limit that a user can not change the
whole value in the textbox at all.
I read the use case description 3 times and still don't totally
understand what you want. No offense meant. Can you explain better?

Greetings
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Aug 30 '06 #2

P: n/a
Laurent Bugnion <ga*********@bluewin.chwrote in news:44f52454$1_4
@news.bluewin.ch:
>I am wondering if any of you Javascript experts can enlighten me on
which event to call. The use situation is that the tetxbox field is
populated from the DB and the add/update and delete will work only
when
>a textbox for reason for change is entered. This mean if a user simply
type in the same value as before, the ASP.NET textbox will be marked
with changed. But it should not limit that a user can not change the
whole value in the textbox at all.

I read the use case description 3 times and still don't totally
understand what you want. No offense meant. Can you explain better?
He wants to know when the user "does something" in the textbox. The user
can type a completely new value into the textbox. Or the user can enter
the default value, and it should still be considered "changed", even
though the value remains the same.

Aug 30 '06 #3

P: n/a
Hi,

Jim Land wrote:
Laurent Bugnion <ga*********@bluewin.chwrote in news:44f52454$1_4
@news.bluewin.ch:
>>I am wondering if any of you Javascript experts can enlighten me on
which event to call. The use situation is that the tetxbox field is
populated from the DB and the add/update and delete will work only
when
>>a textbox for reason for change is entered. This mean if a user simply
type in the same value as before, the ASP.NET textbox will be marked
with changed. But it should not limit that a user can not change the
whole value in the textbox at all.
I read the use case description 3 times and still don't totally
understand what you want. No offense meant. Can you explain better?

He wants to know when the user "does something" in the textbox. The user
can type a completely new value into the textbox. Or the user can enter
the default value, and it should still be considered "changed", even
though the value remains the same.
Thanks.

What about removing the event handler after it has been fired once?
(tested in Firefox and IE6)

<script type="text/javascript">

function checkChanged( tfValue )
{
alert( "In function" );
document.getElementById( "hdChanged" ).value = "true";
tfValue.setAttribute( "onkeypress", "" );
}

</script>

<form id="frmMain" action="test.html">
<input type="text" onkeypress="checkChanged( this );" />
<input type="hidden" id="hdChanged" name="hdChanged"
value="false" />
</form>
HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Aug 30 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.