Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

onchange event problem

 
Sreejith kayappuram
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
am doing some validation for the onChange event of a textbox in HTML. This event fires when i type in a value in the textbox, but does not fire if i change the value of the textbox through javascript HTML code as below

document.getElementById("txtQty").value = 4;

how do i make the onChange event fire if i am changing its value this way? if not possible, then what work around can i use?
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI..

If onChange not working then use onblur for change and check text box status and use like.

onblur return chkfnc
 
Sreejith kayappuram
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i tired that on too. but not worked.
In my case the text field is read only and a calendar is used to set the desired date to text field on clicking a date in calendar.
that part is done using a Javascript where the text field is passed as an argument to that function, and text field 's value is set to the selected date... but the text field's onchange() is not getting fired.
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..

If you use calender and onclick calender text box fill then it is already called java script and if you put another javascript for text box then i think it will not called so use simple text box then and only then you ge fired your javascript function.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic