/    Sign up×
Community /Pin to ProfileBookmark

Hi
I am using a popup calendar which on selectting a date fills the date in a text box.The following code is used to fill the text box
<a onClick=”popUpCalendar(…..);”>
I want that when the user selects the date the form gets submitted.The onchange event for the text box doesnt work.Can somone help?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceMar 28.2005 — I want that when the user selects the date the form gets submitted.The onchange event for the text box doesnt work.Can somone help?[/QUOTE]
That's correct. If a form field is filled in programmatically, the [b]onchange[/b] event doesn't fire. What you'll have to do is have that function submit the form after it fills in the date.
<i>
</i>document.forms["formName"].submit();

However, note that any [b]onsubmit[/b] event you may have coded for this form will also not fire if you use the above. In that case, you would change it to something more like this:
<i>
</i>if(document.forms["formName"].onsubmit){
if(document.forms["formName"].onsubmit()){
document.forms["formName"].submit();
}
} else {
document.forms["formName"].submit();
}
×

Success!

Help @mailtome 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.16,
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,
)...