funeralcrasher: (Default)
So is there a way for Javascript to detect when a textbox changes, before onBlur?

I thought onChange would work, but it seems to act just like onBlur: http://www.sunybroome.edu/~hinton_r/js/blurchangeframe.html (comparison of onBlur and onChange in same page)


Date: 2008-04-09 03:59 pm (UTC)From: [identity profile] bedivere.livejournal.com
Thats actually a bit more of a pain in the butt than one would think. There's no DOM event that really signifies when a input value changes as you jump from field to field (I'm assuming thats what you're trying to trap). You can attach an event handler to the text field and trap the "onFocus" event, capture the current value.. then trap the "onBlur" event as the user leaves the field, and you can compare the current and previous value and see if they've changed. Yahoo UI (http://developer.yahoo.com/yui/) has some libraries that make doing that a bit easier.

Date: 2008-04-10 04:20 am (UTC)From: [identity profile] pkbarbiedoll.livejournal.com
I ended up with onKeyPress to check to see if the textarea is blank. It works perfectly for my needs.

Date: 2008-04-10 02:55 pm (UTC)From: [identity profile] bedivere.livejournal.com
Ah.. right on then. I used that once for a client that wanted all input values to db saved to the database in all uppercase (for reasons too inane to go into), so I hadda trap that and convert character typed to uppercase.
(deleted comment)

Re: crazy question...

Date: 2008-04-10 05:14 pm (UTC)From: [identity profile] pkbarbiedoll.livejournal.com
If you can send the xls to adrya.stembridge@gmail.com I'll return it with properly formatted email addresses in a To: field.

Profile

funeralcrasher: (Default)
funeralcrasher

June 2020

S M T W T F S
 123456
78910111213
141516 1718 1920
21222324252627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 30th, 2025 10:20 am
Powered by Dreamwidth Studios