/    Sign up×
Community /Pin to ProfileBookmark

onfocus for form or ??

I am developing an ajax app where I need to disable a menu when
the user begins to use a form. I have the ‘disabling’ code well in hand,
but since I have never used event handlers for forms, I would welcome
opinions on whether the [B]onfocus[/B] event would be the preferable
event to attach. And if not, what event would be the optimum.

thanks
tim

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@rtretheweyFeb 06.2012 — You'd need to put the onfocus() setting on all of the individual <input> elements because <form> doesn't support onfocus(), but it could be done. Good luck!
Copy linkTweet thisAlerts:
@tim042849authorFeb 06.2012 — Thanks for the reply, Rick.

I see from http://www.w3schools.com/tags/tag_form.asp

under The <form> tag supports the following event attributes:[/quote]
That the [B]onclick[/B] event [B]is[/B] supported.

1)Would you recommend using [B]onclick[/B]

2)Regarding installing an [B]onfocus[/B] event listener for all elements

would be trivial for me - would just entail some minor code additions

in my server-side view handling, but ? I'm a little lazy and want to

keep the content compact.

What do you think about using [COLOR="DarkRed"]onclick[/COLOR]?

thanks again
Copy linkTweet thisAlerts:
@tim042849authorFeb 06.2012 — Well, I've done a little testing. I am finding that there are unexpected

results with an onclick handler in the form tag. But, it looks like [COLOR="DarkRed"]onmouseover[/COLOR] does the trick.

cheers? tim
×

Success!

Help @tim042849 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...