aspose file tools*
The moose likes Struts and the fly likes onchange event problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "onchange event problem" Watch "onchange event problem" New topic
Author

onchange event problem

Sreejith kayappuram
Ranch Hand

Joined: Jun 24, 2008
Posts: 35
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?


Thanks
Sreejith
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 688

HI..

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

onblur return chkfnc


Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
Sreejith kayappuram
Ranch Hand

Joined: Jun 24, 2008
Posts: 35
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

Joined: Sep 07, 2008
Posts: 688

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: onchange event problem